Bug #50148 "Error in my_thread_global_end(): 1 threads didn't exit" with perfschema
Submitted: 7 Jan 2010 17:50 Modified: 14 Jan 2010 18:24
Reporter: Marc Alff Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Performance Schema Severity:S2 (Serious)
Version:mysql-trunk-perfschema OS:Any
Assigned to: Marc Alff
Triage: Triaged: D4 (Minor)

[7 Jan 2010 17:50] Marc Alff
When using a build including the performance schema,
users have reported spurious error messages like:
"Error in my_thread_global_end(): 1 threads didn't exit"
at shutdown.

How to repeat:
No known repeatable test case.

Seen once in mysql-6.0-codebase-perfschema on a development machine,
when executing:
./mysqld --verbose --help
[7 Jan 2010 17:52] Marc Alff
Verified on developer machine, no reproductible test case
[7 Jan 2010 18:19] 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:


2998 Marc Alff	2010-01-07
      Bug#50148 "Error in my_thread_global_end(): 1 threads didn't exit" with perfschema
      When compiling a server with the performance schema, spurious messages
      like "Error in my_thread_global_end(): 1 threads didn't exit" could sometime
      be seen during shutdown.
      The root cause for this issue is as follows (found by analysis):
      - initialize_performance_schema(), depending on the startup parameters,
        would sometime not create the THR_PFS key with pthread_key_create().
      - shutdown_performance_schema() would execute
        my_pthread_setspecific_ptr(THR_PFS, NULL);
        for an uninitialized key.
      On a linux box in debug, the value of a non initialized THR_PFS key
      is 0, which matches the value of the first key created by the server,
      The net effect of this code is:
      - shutdown_performance_schema() would knock down the thread local storage
      used by mysys during shutdown, causing unexpected failures.
      The fix is to ensure that cleanup in thread local storage for the
      performance schema is only executed when initialization was done.
      No test case provided (no repeatable test case).
[11 Jan 2010 19:40] Marc Alff
Queued in mysql-trunk-perfschema / mysql-6.0-codebase-perfschema
[14 Jan 2010 10:06] Marc Alff
Merged in:
- mysql-next-mr (Celosia / 5.5.99-m3)
- mysql-6.0-codebase (6.0.14)
[14 Jan 2010 18:24] Paul Dubois
Not in any released version. No changelog entry needed.