Bug #57727 MyODBC driver message: Error in my_thread_global_end(): 39 threads didn't exit
Submitted: 26 Oct 2010 6:34 Modified: 25 Jan 2012 23:22
Reporter: Bogdan Degtyariov Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.1.7 OS:Other (All non-Windows OS)
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[26 Oct 2010 6:34] Bogdan Degtyariov
Description:
MyODBC driver does not call mysql_thread_end() when the thread ends causing error messages such as this:

Error in my_thread_global_end(): 39 threads didn't exit

Current driver implementation calls mysql_thread_end() only for the main thread, which allocate the environment handler SQLHENV. However, this handler can be shared between threads and other threads do not un-initialize mysql client buffers properly.

How to repeat:
The test case would be too complicated... it could not be run within the current testing suite.

Suggested fix:
Add thread counters for each SQLAllocConnect() and call mysql_thread_end.

See the patch uploaded below.
[26 Oct 2010 7:44] Bogdan Degtyariov
patch

Attachment: bug57727.diff (text/x-diff), 2.28 KiB.

[26 Oct 2010 7:46] Bogdan Degtyariov
patched file (for convenience)

Attachment: handle.c (text/plain), 18.67 KiB.

[30 Sep 2011 10:55] Lawrenty Novitsky
pushed as rev#999. will be included to the next(after 5.1.8) release
[25 Jan 2012 23:22] Philip Olson
This was already documented, as:

The Connector/ODBC driver did not call
mysql_thread_end() when a thread
ended, which caused error messages like: Error in
my_thread_global_end(): 1 threads didn't exit.

So, closing.
[8 Mar 2016 10:24] Bogdan Degtyariov
Posted by developer:
 
Fixed in the newer versions. Closing the bug