Bug #37961 | "Trying to destroy unitialized mutex" crash when server can not start | ||
---|---|---|---|
Submitted: | 8 Jul 2008 10:41 | Modified: | 26 Oct 2008 0:27 |
Reporter: | Philip Stoev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 6.0 | OS: | Any |
Assigned to: | Dmitry Lenev | CPU Architecture: | Any |
[8 Jul 2008 10:41]
Philip Stoev
[9 Jul 2008 16:04]
Philip Stoev
Setting to Open so that the bug verification team can check previous releases.
[10 Jul 2008 17:59]
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/49488 2677 Dmitry Lenev 2008-07-10 Fix for bug#37961 "'Trying to destroy unitialized mutex' when --datadir does not exist". Attempt to start server with non-existing data directory led to destroying of uninitialized LOCK_mdl mutex and assertion failure. The problem was that unireg_abort() function, which is called in case of error during server start-up and which assumes that it can be called even for partially initialized server, has called mdl_destroy() function which assumed that mdl_init() was successfully performed prior to its call. This patch tries to satisfy assumption made by unireg_abort() by splitting MDL subsystem initialization and deinitialization in two phases. The first phase initializes locks and condition variables and happens early during server start-up (so during unireg_abort() we can assume that it has already happened and safely perform deinitialization). The second phase, which happens later, is responsible for memory allocation. Since corresponding deinitialization function can be called even without prior call initialization function it can be safely used in unireg_abort() as well. No test case is provided since such situation can't be covered by our test suite.
[10 Jul 2008 18:29]
Philip Stoev
Hello, Thank you for the quick turnaround. I think you can actually test this situation -- create an .opt file containing "--datadir=/no/such/dir". Then your test can simply do a SELECT 1 . this will require one extra server restart in the test suite though.
[28 Jul 2008 20:24]
Philip Stoev
This crash happens for any reason that prevents the server from starting, for example, if it is being run under the root account.
[1 Oct 2008 6:26]
Dmitry Lenev
Original problem with LOCK_mdl initialization which was described in this bug report was fixed by Monty in manner which is different from patch proposed above (see his merge from maria tree from 2008-08-13). Unfortunately similar problem now arises with mutex in backup system. Here is a stack-trace which is now generated when one tries to run server with wrong --datadir parameter: /lib/libc.so.6(abort+0x103)[0xb7d34fc3] sql/mysqld(safe_mutex_destroy+0x4f)[0x892392e] sql/mysqld(_Z15backup_shutdownv+0x32)[0x89bce2e] sql/mysqld[0x82f65db] sql/mysqld(unireg_abort+0x7c)[0x82f8e44] sql/mysqld(main+0x190)[0x82fb6ca] /lib/libc.so.6(__libc_start_main+0xdc)[0xb7d2087c] sql/mysqld(__gxx_personality_v0+0x13d)[0x8213da1]
[1 Oct 2008 10:13]
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/54903 2717 Dmitry Lenev 2008-10-01 Fix for bug#37961 "'Trying to destroy unitialized mutex' when --datadir does not exist". Attempt to start server with non-existing data directory led to destroying of uninitialized Backup_restore_ctx::run_lock mutex and assertion failure. The problem was that unireg_abort() function, which is called in case of error during server start-up and which assumes that it can be called even for partially initialized server, has called backup_shutdown() function which assumed that backup_init() was successfully performed prior to its call. This patch solves problem by ensuring that backup_shutdown() can be safely called without prior call to backup_init() and thus satisfying assumption made by unireg_abort(). Note that similar problem with LOCK_mdl has been already solved by Monty's patch from 2008-08-13 in similar fashion. No test case is provided since such situation can't be easily covered by our test suite.
[1 Oct 2008 14:01]
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/54950 2717 Dmitry Lenev 2008-10-01 Fix for bug#37961 "'Trying to destroy unitialized mutex' when --datadir does not exist". Attempt to start server with non-existing data directory led to destroying of uninitialized Backup_restore_ctx::run_lock mutex and assertion failure. The problem was that unireg_abort() function, which is called in case of error during server start-up and which assumes that it can be called even for partially initialized server, has called backup_shutdown() function which assumed that backup_init() was successfully performed prior to its call. This patch solves problem by ensuring that backup_shutdown() can be safely called without prior call to backup_init() and thus satisfying assumption made by unireg_abort(). Note that similar problem with LOCK_mdl has been already solved by Monty's patch from 2008-08-13 in similar fashion. No test case is provided since such situation can't be easily covered by our test suite.
[24 Oct 2008 1:18]
Bugs System
Pushed into 6.0.8-alpha (revid:dlenev@mysql.com-20081001101428-up4eba8jyf6ipy5v) (version source revid:dlenev@mysql.com-20081001101428-up4eba8jyf6ipy5v) (pib:5)
[26 Oct 2008 0:27]
Paul DuBois
Noted in 6.0.8 changelog. Errors during server startup caused destruction of an uninitialized mutex and assertion failure.