Bug #17029 A non-blocking socket operation could not be completed immediately
Submitted: 2 Feb 2006 1:18 Modified: 15 May 2007 9:55
Reporter: Yvan Rodrigues Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:1.0.7 OS:Microsoft Windows (Windows XP Home)
Assigned to: CPU Architecture:Any

[2 Feb 2006 1:18] Yvan Rodrigues
Description:
I noticed this has been frequently reported in the forums.

I have only experienced this in 1.0.7, not 1.0.6

When attempting to establish a connection the System.Net.Sockets.SocketException is thrown in SocketStream.cs on line 174 at:

			try 
			{
				socket.Connect(remoteEP);
			}

I am building this in C# in VS2003
The remote server is over a WAN link and is running mysql4

I have tried setting a large "connect timeout" in the connection string.

How to repeat:
My code snippet looks like:

			// create the one and only connection resource to be used.
			this.mySqlConnection = new MySql.Data.MySqlClient.MySqlConnection();
			this.mySqlConnection.ConnectionString =	"Server=" + this.C.DbServer + ";Database=" + this.C.DbDatabase + ";UserID=" + this.C.DbUser + ";Password=" + this.C.DbPassword + ";Port=" + this.C.DbPort;
			// open it
			try 
			{
				this.mySqlConnection.Open();
				// verify it
				if(!this.mySqlConnection.Ping()) 
				{
					System.Windows.Forms.MessageBox.Show("The server is not currently available. Most functions will not be available.", "Server not available", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
					return;
				}
			} 
			catch(Exception e) 
			{
				System.Windows.Forms.MessageBox.Show(e.Message, e.Source, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
			}
[2 Feb 2006 1:28] Yvan Rodrigues
I rolled the .dll in my project back to 1.0.6.

It still tripped the exception BUT when I turned off first-chance exception handling for System.Net.Sockets in the CLR my try/catch no longer caught the exception.

In 1.0.7 this is not the case. Even with the first-chance exception handling turned off, my try/catch is tripped.

This would indicate that perhaps the exception is "normal" (or unavoidable) but that it is being handled by pre-1.0.7 and this changed in 1.0.7
[2 Feb 2006 4:14] Yvan Rodrigues
Same as 15488?
[5 Apr 2006 8:28] Tonci Grgin
Hi.
Thanks for your problem report. Could you please provide me with test case application to reproduce the bug?
[5 Apr 2006 16:29] Yvan Rodrigues
I will put together a test solution. Please wait a few days, as I'm pretty busy right now.
[5 May 2006 23:01] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[25 Jun 2006 22:46] Yvan Rodrigues
I changed service providers. The old was 4.0.23 standard-log. The new is 4.1.19 standard-log. I no longer have this problem with the newer version. I can compile in version 1.0.7 of the connector and it works fine.
[26 Jun 2006 5:10] Tonci Grgin
Yvan, glad yourproblem is solved. Please set this report to "Closed" state.
[26 Jul 2006 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".