| Bug #26152 | Opening a connection is really slow | ||
|---|---|---|---|
| Submitted: | 7 Feb 2007 18:20 | Modified: | 22 Feb 2007 11:19 |
| Reporter: | Paolo Niccolò Giubelli | ||
| Status: | Closed | ||
| Category: | Connector/Net | Severity: | S5 (Performance) |
| Version: | 5.0.3 | OS: | Microsoft Windows (Windows Vista RC1) |
| Assigned to: | Target Version: | ||
| Tags: | connector, slow, Connection | ||
[9 Feb 2007 10:49]
Paolo Niccolò Giubelli
I noticed that the 'bug' is located into the method GetStream() (StreamCreator.cs) at line
73. I changed the statement:
*---------*
IPHostEntry ipHE = Dns.GetHostEntry(dnsHosts[index]);
*---------*
whith
*---------*
IPAddress addr = null;
IPHostEntry ipHE;
if (IPAddress.TryParse(dnsHosts[index], out addr))
{
ipHE = new IPHostEntry();
ipHE.AddressList = new IPAddress[1];
ipHE.AddressList[0] = addr;
}
else
ipHE = Dns.GetHostEntry(dnsHosts[index]);
*----------*
and now it works good. I had also noticed that the original version works good if I use
the dns name instead of the ip address.
The 1.0.9 version is not affected by this problem because it invokes the deprecated
method 'GetHostByName' that seems to work differently from the GetHostEntry() one. I hope
this helps.
Regards,
Paolo Niccolo' Giubelli
ITestense s.n.c.
[20 Feb 2007 21:49]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/20230
[20 Feb 2007 21:49]
Reggie Burnett
Fixed in 5.0.4
[22 Feb 2007 11:19]
MC Brown
A note has been added to the 5.0.4 changelog.

Description: The connection opening task is really slow using this version of the .net connector. The 1.0x version seems to be really faster. How to repeat: Simply write this code [C#] MySqlConnection conn = new MySqlConnection("Server=192.168.1.2;Database=xxx;Uid=xxx;Pwd=xx;"); conn.Open(); conn.Close(); Place a breakpoint on the .Open() line and one on the .Close() line, so you will be able to experience the ~5-6 seconds delay between them. I tried the same program (on the same machine / server of course) using the 1.0.9 connector and it works good. My computer is an amd athlon x2 3800+.