Bug #70639 THR_LOCK_mutex is used before being initialized
Submitted: 16 Oct 2013 19:36 Modified: 12 Feb 2014 22:57
Reporter: Davi Arnaut (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.5,5.6,5.7 OS:Any
Assigned to: CPU Architecture:Any

[16 Oct 2013 19:36] Davi Arnaut
Description:
If SAFE_MUTEX is enabled, THR_LOCK_mutex will be used before being initialized.
The problem is that my_thread_global_init() initializes mutexes before the safe
mutex subsystem is initialized with safe_mutex_global_init(). When safe mutex is
enabled, initializing a mutex invokes safe_mutex_init() which uses THR_LOCK_mutex.

This sometimes leads to a crash in comp_err while building MySQL on Mac OS X.

How to repeat:
Inspect said code paths.
[22 Oct 2013 13:22] MySQL Verification Team
Code inspection revealed that this bug is, indeed, present in the code and can hit anyone who is testing the server.

Category is based both on the area affected and the mutex that makes a problem.
[12 Feb 2014 22:57] Paul DuBois
Noted in 5.7.4 changelog.

If SAFE_MUTEX was enabled (true only for debug builds),
THR_LOCK_mutex was used before being initialized.