Bug #54334 Double initialization of mysys mutexes
Submitted: 8 Jun 2010 12:19 Modified: 10 Jun 2010 14:01
Reporter: Marc Alff Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: General Severity:S2 (Serious)
Version:mysql-trunk (5.5.3) OS:Any
Assigned to: Marc Alff CPU Architecture:Any

[8 Jun 2010 12:19] Marc Alff
Reported by Davi, found with third party tools.

Mysys mutexes are initialized twice, in my_init().

The duplicated initialization comes form mysys/mt_init.c

a) in my_basic_init()

106 #if defined(THREAD)
107 if (my_thread_global_init())
108 return 1;

b) in my_basic_init()

121 if (my_thread_basic_global_init())
122 return 1;

How to repeat:
read the code

Suggested fix:
Remove lines 107-108
[8 Jun 2010 12:42] 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:


3092 Marc Alff	2010-06-08
      Bug#54334 Double initialization of mysys mutexes
      Prior to this fix, mysys mutexes such as THR_LOCK_lock could be initialized
      twice by a call to my_init().
      The root cause was out of place initialization in my_basic_init(),
      calling my_thread_global_init().
      With this fix,
      - my_basic_init() properly initializes the mutex implementation itself,
      for SAFE or FAST mutexes, and for platform dependent initializations,
      before initialiazing a mutex.
      - my_init() properly initializes mysys mutexes once,
      when making the first call to my_thread_global_init().
[8 Jun 2010 13:01] Marc Alff
Pushed into:
- mysql-trunk-bugfixing
- mysql-next-mr-bugfixing
[10 Jun 2010 14:01] Alexander Nozdrin
The patch was reverted.
[15 Jun 2010 8:12] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100615080459-smuswd9ooeywcxuc) (version source revid:alik@sun.com-20100615080459-smuswd9ooeywcxuc) (merge vers: 5.5.5-m3) (pib:16)
[15 Jun 2010 8:28] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100615080558-cw01bzdqr1bdmmec) (version source revid:alik@sun.com-20100615080431-gu5icn0anrt47dsx) (pib:16)
[3 Oct 2014 11:19] Hartmut Holzgraefe
Seems to be fixed to me (in 5.6.20 at least)?
[8 Jun 2016 15:27] Hartmut Holzgraefe
Could someone check whether this is indeed fixed or not, 
and close the bug if ...?