Bug #57052 Client hangs when network connection to the server is interrupted.
Submitted: 28 Sep 2010 7:40 Modified: 8 Oct 2010 9:32
Reporter: Bonny Gijzen Email Updates:
Status: Verified Impact on me:
Category:Connector / ODBC Severity:S4 (Feature request)
Version:Connector 5.1 OS:Windows (win 7)
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[28 Sep 2010 7:40] Bonny Gijzen
Very rarily when using a simple query my applications hangs for a long time. 
The hang happens on recv() in function SQLExecDirectW() which is called by the connector. 

Here is a stacktrace to show it: 
77a1f85a +00e ntdll.dll NtWaitForSingleObject 
76954861 +082 WS2_32.dll recv 
6db6a64b +079 ODBC32.dll SQLExecDirectW 
004cafa6 +056 BiljartScoreBord.exe ADODB TADOConnection.Execute 
0058a8b8 +0b0 BiljartScoreBord.exe Unit2 TForm2.SendServerKeepAlive 

A more detailed explanation can be found here:

To me this bug seems identical to bug #40407 for connector 3.51

How to repeat:
I am not able to tell you how to reproduce it easily (perhaps using same test case as bug #40407 ?).

Suggested fix:
Make sure the READTIMEOUT and WRITETIMEOUT options are available in connector 5.1, as was fixed for connector 3.51 in bug #40407.

The documentation I found on this wasn't clear to me if this is fixed in connector 5.1 or not ...
[28 Sep 2010 9:19] Peter Laursen
I think it may be important you tell your Windows version.

refer: http://bugs.mysql.com/bug.php?id=31109 and http://bugs.mysql.com/bug.php?id=46531.
[28 Sep 2010 9:28] Bonny Gijzen
For now it has happened only on Windows 7 machines.
[28 Sep 2010 9:32] Bonny Gijzen
Indeed it looks much like bug #31109.

If the MYSQL_OPT_READ_TIMEOUT (READTIMEOUT option) is/would be implemented in 5.1 then this problem should be solved.

However I can only find documentation saying that 3.51 is fixed and nothing about 5.1
[8 Oct 2010 9:27] Bogdan Degtyariov
Hi Bonny,

Thank you for reporting this problem in MySQL ODBC Driver.
Actually, READTIMEOUT and WRITETIMEOUT have been implemented in Connector/ODBC driver 5.1. However, the GUI setup dialog misses these options.

In Linux you can edit the odbc.ini configuration file and manually add


For Windows it is a little bit more tricky:

 - Open the registry editor (regedit.exe)
 - For System DSN you should open:


   If it is User DSN open:


   Add new string REG_SZ values:

     value name: READTIMEOUT
     data: <numeric_timeout>

Also, these options can be used in the connection string:


Meanwhile I will mark this report as a feature request.
[8 Oct 2010 9:32] Bonny Gijzen
Hi Bogdan,

Thanks for the follow up.

>Also, these options can be used in the connection string:

Well this is exactly what I wanted to hear.
In fact I already tried it and I was able to verify that these options were actually implemented on 5.1 and working as they should.

You can close this bug because it was related to not being able to find these options mentioned in the CHANGELOG of the 5.1 driver.
(They are only mentioned in the 3.51 changelog.)