Bug #30274 Debug server crashes because mutex isn't initialized
Submitted: 7 Aug 2007 13:04 Modified: 8 Aug 2007 15:27
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.1.21 OS:Other (if HAVE_GETHRTIME)
Assigned to: Mats Kindahl CPU Architecture:Any

[7 Aug 2007 13:04] Joerg Bruehe
Description:
Occurred in builds of 5.1.21-beta.

Symptom:

=====
cd mysql-test ; MTR_BUILD_THREAD=auto \
/usr/local/bin/perl ./mysql-test-run.pl --comment=debug  --force --timer \
--skip-ndbcluster --skip-rpl --report-features
Requesting build thread... got 200
Logging: ./mysql-test-run.pl --comment=debug --force --timer --skip-ndbcluster --skip-rpl --report-features
safe_mutex: Trying to lock unitialized mutex at my_getsystime.c, line 175
mysql-test-run: *** ERROR: Could not find version of MySQL
Autoreleasing /tmp/mysql-test-ports:200
gmake: [test-bt-debug] Error 1 (ignored)
2007-08-07 05:08:19  DONE  run the test suites
=====

Platforms:
10* Solaris
2* HP-UX

From looking at the code, it is those which define "HAVE_GETHRTIME".

How to repeat:
Build + start a debug server on a platform with "HAVE_GETHRTIME".

Suggested fix:
Check mutex initialization,
especially its order relative to the first use.
[7 Aug 2007 19:53] 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:

  http://lists.mysql.com/commits/32219

ChangeSet@1.2559, 2007-08-07 22:54:42+03:00, jani@a88-113-38-195.elisa-laajakaista.fi +1 -0
  Removed a wrong call to my_time() before my_init() has been called.
  
  Fix for Bug#30274 "Debug server crashes because mutex isn't initialized"
[7 Aug 2007 21:07] Joerg Bruehe
The patch has been applied to the 5.1.21-beta release clone directly,
and builds are restarted.

Note that this was a duplication of the patch, not a BK transfer,
so the changeset comment differs and the bug# is not mentioned.

This problem was not present in any released version,
so there is no need for any documentation.
[8 Aug 2007 13:26] 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:

  http://lists.mysql.com/commits/32250

ChangeSet@1.2560, 2007-08-08 16:28:00+03:00, mats@a88-113-38-195.elisa-laajakaista.fi +1 -0
  BUG#30274 (Debug server crashes because mutex isn't initialized):
  
  Completion patch, since it is possible that Log_event::write_header()
  is called with no current thread.
  
  When starting the server, there is no thread available, but
  MYSQL_BIN_LOG::open() is called to initialize the binary log. The
  function writes a format description log event to the binary log,
  which means that Log_event::write_header() can be called with no
  current thread object available.
[8 Aug 2007 13:49] 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:

  http://lists.mysql.com/commits/32251

ChangeSet@1.2561, 2007-08-08 16:50:43+03:00, jani@a88-113-38-195.elisa-laajakaista.fi +1 -0
  BUG#30274 (Debug server crashes because mutex isn't initialized):
  
  Completion patch, since it is possible that Log_event::write_header()
  is called with no current thread.
  
  When starting the server, there is no thread available, but
  MYSQL_BIN_LOG::open() is called to initialize the binary log. The
  function writes a format description log event to the binary log,
  which means that Log_event::write_header() can be called with no
  current thread object available.
[24 Aug 2007 21:58] Bugs System
Pushed into 5.1.23-beta
[31 Aug 2007 18:22] John David Duncan
FYI:  This might still be a problem,  *not* for mysqld,  but for NDB API programs that are compiled against 5.1.21 --with-debug.

I am seeing  safe_mutex: Trying to lock unitialized mutex at my_thr_init.c, line 286

(This is not the same place as the original bug report, where the attempt to lock the mutex is in my_getsystime.c)

For further info see http://code.google.com/p/mod-ndb/issues/detail?id=34