Bug #17486 | IM: race condition on exit | ||
---|---|---|---|
Submitted: | 16 Feb 2006 17:10 | Modified: | 7 Nov 2006 18:59 |
Reporter: | Lenz Grimmer | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Instance Manager | Severity: | S3 (Non-critical) |
Version: | 5.1.6 | OS: | Linux (SUSE Linux 10.0) |
Assigned to: | Alexander Nozdrin | CPU Architecture: | Any |
[16 Feb 2006 17:10]
Lenz Grimmer
[16 Feb 2006 17:24]
Lenz Grimmer
The behaviour is not very deterministic - it acutally seems as if the IM succeeds in shutting down the instance once, but then looses track of it. Shutting down MySQL using "/etc/init.d/mysql stop" afterwards does not succeed anymore - the IM terminates, but leaves stray mysqld processes behind that are still active.
[11 Sep 2006 9:06]
Alexander Nozdrin
1. Instance Manager has changed since initial report of this bug. Now, it has "--mysqld-safe-compatible" option responsible for managing default instance. So, this part of the bug report is fixed. 2. However, there are still two problems: 1. Instance Manager does not shutdown properly on SIGTERM: - There is stray mysqld instance; - It takes too much time for IM to stop. If IM is stopped from mysql.server script, the script does not detect that IM stopped and reports an error. 2. It seems, there is race condition on exit by SIGQUIT -- IM stops (stops quickly and shuts down mysqld), but it seems that the main thread finishes before all other threads are stopped.
[17 Oct 2006 13:02]
Alexander Nozdrin
Now the only problem is the second one: the main thread does not wait for all others to stop before exiting.
[19 Oct 2006 9: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/13951 ChangeSet@1.2351, 2006-10-19 13:12:45+04:00, anozdrin@booka.aliknet +10 -0 Fix for BUG#17486: IM: race condition on exit. IM uses wait()/waitpid() system calls to wait for started mysqld to stop. The problem was that return values of these functions were ignored. So, IM assumed that if wait() returns, mysqld is down. However, this can be not so, if wait() was interrupted by SIGINT/SIGTERM. The fix is to call wait()/waitpid() again if the previous call was interrupted.
[23 Oct 2006 11:38]
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/14174 ChangeSet@1.2351, 2006-10-23 15:37:01+04:00, anozdrin@booka. +10 -0 Fix for BUG#17486: IM: race condition on exit. The problem was that IM stoped guarded instances on shutdown, but didn't wait for them to stop. The fix is to wait for guarded instances to stop before exitting from the main thread. The idea is that Instance-monitoring thread should add itself to Thread_registry so that it will be taken into account on shutdown. However, Thread_registry should not signal it on shutdown in order to not interrupt wait()/waitpid().
[23 Oct 2006 12:48]
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/14180 ChangeSet@1.2351, 2006-10-23 16:47:33+04:00, anozdrin@booka. +11 -0 Fix for BUG#17486: IM: race condition on exit. The problem was that IM stoped guarded instances on shutdown, but didn't wait for them to stop. The fix is to wait for guarded instances to stop before exitting from the main thread. The idea is that Instance-monitoring thread should add itself to Thread_registry so that it will be taken into account on shutdown. However, Thread_registry should not signal it on shutdown in order to not interrupt wait()/waitpid(). --- IM polishing: log more information in log.
[23 Oct 2006 12: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/14181 ChangeSet@1.2351, 2006-10-23 16:48:18+04:00, anozdrin@booka. +10 -0 Fix for BUG#17486: IM: race condition on exit. The problem was that IM stoped guarded instances on shutdown, but didn't wait for them to stop. The fix is to wait for guarded instances to stop before exitting from the main thread. The idea is that Instance-monitoring thread should add itself to Thread_registry so that it will be taken into account on shutdown. However, Thread_registry should not signal it on shutdown in order to not interrupt wait()/waitpid(). --- IM polishing: log more information in log.
[24 Oct 2006 14:22]
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/14266 ChangeSet@1.2324, 2006-10-24 18:23:16+04:00, anozdrin@alik. +10 -0 Fix for BUG#17486: IM: race condition on exit. The problem was that IM stoped guarded instances on shutdown, but didn't wait for them to stop. The fix is to wait for guarded instances to stop before exitting from the main thread. The idea is that Instance-monitoring thread should add itself to Thread_registry so that it will be taken into account on shutdown. However, Thread_registry should not signal it on shutdown in order to not interrupt wait()/waitpid().
[25 Oct 2006 9:41]
Konstantin Osipov
Reviewed over email and irc.
[2 Nov 2006 14:32]
Dmitry Lenev
Fixed in 5.1.13
[7 Nov 2006 18:59]
Paul DuBois
Noted in 5.1.13 changelog. At shutdown, Instance Manager told guarded server instances to stop, but did not wait until they actually stopped.