Bug #15462 can't open connection too
Submitted: 3 Dec 2005 17:25 Modified: 15 Oct 2006 4:07
Reporter: jose manuel enriquez Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:1.0.7 OS:Windows (win2k)
Assigned to: Assigned Account CPU Architecture:Any

[3 Dec 2005 17:25] jose manuel enriquez
Description:

Like Oscar Acosta and willi muellner in http://bugs.mysql.com/bug.php?id=14917 i can't open connection. 

Problem with connector/net 1.0.7 and 1.0.6, but not with 1.0.5 and 1.0.4.

The problem happens debuging the solution (inside VS) NOT runnig the application from Windows Explorer (outside VS)

Software:

Win2k SP4, VS 2003 (v. 7.1.3088), .NET framework 1.1.4322, MySQL 5.0.16-nt via TCP/IP, Connector/NET 1.0.7
Also happens with Win2003Server.

Thanks.

How to repeat:
Simple test case:

using System;
using MySql.Data.MySqlClient;

namespace TestMySql
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			MySqlConnection cn = new MySqlConnection("Server=127.0.0.1;Database=test;Uid=root;Pwd=;");
			try
			{
				cn.Open();
				Console.WriteLine("Ok.");
			}
			catch(Exception e)
			{
				Console.WriteLine("Message: " + e.Message 
					+ "\nInnerException: " + e.InnerException 
					+ "\nSource: " + e.Source
					+ "\nStackTrace: " + e.StackTrace);
			}
			finally
			{
				cn.Close();
			}
			Console.ReadLine();
		}
	}
}

Test case output (note: VS/framework spanish version):

Message: Se ha anulado una conexión establecida por el software en su equipo host
InnerException: System.Net.Sockets.SocketException: Se ha anulado una conexión establecida por el software en su equipo host
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at MySql.Data.Common.SocketStream.Read(Byte[] buffer, Int32 offset, Int32 count)
Source: MySql.Data
StackTrace:    at MySql.Data.Common.SocketStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.BufferedStream.ReadByte()
   at MySql.Data.MySqlClient.PacketReader.ReadHeader()
   at MySql.Data.MySqlClient.PacketReader.OpenPacket()
   at MySql.Data.MySqlClient.NativeDriver.Authenticate411()
   at MySql.Data.MySqlClient.NativeDriver.Authenticate()
   at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionString settings)
   at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlPoolManager.GetConnection(MySqlConnectionString settings)
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at TestMySql.Class1.Main(String[] args) in c:\documents and settings\administrador\mis documentos\visual studio projects\testmysql\testmysql\class1.cs:line 14
[3 Dec 2005 17:27] jose manuel enriquez
trace files (http://dev.mysql.com/doc/refman/5.0/en/making-trace-files.html)

Attachment: trace_files.zip (application/x-zip-compressed, text), 71.98 KiB.

[4 Dec 2005 11:34] Vasily Kishkin
Thanks for the bug report. I was able to reproduce on .NET 1.1:

Message: Unable to connect to any of the specified MySQL hosts
InnerException: System.TypeLoadException: Invalid PInvoke metadata format.
   at System.Net.OSSOCK.gethostbyname(String host)
   at System.Net.Dns.GetHostByName(String hostName)
   at MySql.Data.Common.StreamCreator.GetStream(Int32 timeOut)
   at MySql.Data.MySqlClient.NativeDriver.Open()
Source: MySql.Data
StackTrace:    at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlPoolManager.GetConnection(MySqlConnectionString settings)
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at TestMySql.Class1.Main(String[] args)

I would like to notice .NET 1.0 works fine.
[15 Sep 2006 4:07] Reggie Burnett
We recently fixed a problem that would cause sporading failures when IPv6 are involved.  not sure that's the case here but the user should try 1.0.8 or 5.0.1 when they are released.
[15 Oct 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".