Bug #31607 error on shutdown when using ODBC 3.51 driver with ADO
Submitted: 15 Oct 2007 12:52 Modified: 7 Nov 2007 9:23
Reporter: nigel hughes Email Updates:
Status: Duplicate Impact on me:
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Microsoft Windows (XP SP2)
Assigned to: CPU Architecture:Any

[15 Oct 2007 12:52] nigel hughes

Using the ODBC connector from an ADO Connector object imported using the #import statement on any thread causes an application to generate an error on shutdown.

How to repeat:
Create a new 'Hello World' console application using the VS6 application wizard.
add this line to stdafx.h

#import "\program files\common files\system\ado\msado15.dll" named_guids, no_namespace, rename ( "EOF", "adoEOF" )

add these lines to main()

int main(int argc, char* argv[])
   _ConnectionPtr m_spCon(CLSID_Connection);

   m_spCon->Open("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=venues;Option=3;", "root", "zzz111", adConnectUnspecified);
 return 0;

run the app. It will exit immediately.
There will be a delay of 5 or so seconds while it tries to close.
An message will appear briefly in the console window reporting in error my_thread or similar.

Removing the ->Open() statement causes the error to go away.
[16 Oct 2007 1:12] nigel hughes
The exact message is 'Error in my_thread_global_end(): 1 threads didn't exit'. It has been reported as a bug already.
[16 Oct 2007 3:17] nigel hughes
The exact message is 'Error in my_thread_global_end(): 1 threads didn't exit'. It has been reported as a bug already but only with respect to PHP and libmysql. This error is generated by myodbc3.dll. 
It does not occur when using ODBC from VB only from C++ but using both #import and CComQIPtr<>. It causes about a 5 second delay on shutdown but might also be causing resources to not be correctly released.
[16 Oct 2007 10:19] Susanne Ebrecht
Hello Nigel,

thanks, that you inform us about this issue. We will check this.


[5 Nov 2007 20:14] Jim Winstead
This is probably a result of Bug #25621. Connector/ODBC needs to be built against a version of the MySQL client library with that bug fixed.
[7 Nov 2007 9:23] Tonci Grgin
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Explanation: I agree with Jim and this is a duplicate of Bug#25621. Please link against 5.0.50 libraries as I was unable to repeat the original problem there.