[MDEV-6040] [PATCH] MariaDB hangs if terminated quickly after start Created: 2014-04-07  Updated: 2014-04-10  Resolved: 2014-04-10

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.10
Fix Version/s: 10.0.11

Type: Bug Priority: Major
Reporter: Pavel Ivanov Assignee: Kristian Nielsen
Resolution: Fixed Votes: 0
Labels: None


 Description   

If MariaDB receives SIGTERM after the call to start_signal_handler() but before the call to init_slave() then kill_server_thread() will call close_connections() (through kill_server() ) which will ask all threads to terminate and will start to wait on COND_thread_count. After that init_slave() will be called, it will call run_slave_init_thread(), which will launch handle_slave_init() and will start to wait on COND_thread_count too. At this point if handle_slave_init() calls mysql_cond_signal(&COND_thread_count) then it can wake up close_connections() which will do nothing and return back to sleep. But run_slave_init_thread() will remain sleeping and no one will ever wake it up, MariaDB will hang forever with "kill -9" as the only chance to exit.

So the call to mysql_cond_signal(&COND_thread_count) in the handle_slave_init() should be changed to mysql_cond_broadcast(&COND_thread_count).

Note that calling *_broadcast instead of *_signal matches all other usages of COND_thread_count throughout MariaDB code.



 Comments   
Comment by Pavel Ivanov [ 2014-04-07 ]

The call to mysql_cond_signal that needs to be changed is at slave.cc:321 now.

Comment by Kristian Nielsen [ 2014-04-10 ]

Nice find, thanks Pavel!

Pushed to 10.0

Generated at Thu Feb 08 07:08:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.