Commit b5000fba authored by unknown's avatar unknown

Bug#18235: assertion/crash when windows mysqld is ended with ctrl-c

Two threads both try a shutdown sequence which creates a race to the
de-init/free of certain resources.

This exists in similar form in the client as 17926: "mysql.exe crashes
when ctrl-c is pressed in windows."


sql/mysqld.cc:
  We have three potential ways of hitting the iceberg:
  - unireg_end()   has basic de-init
  - unireg_abort() has extended de-init
  - main() has a de-init sequence similar to unireg_abort()
  
  In the Windows version of the server, Control-C is handled
  in a different thread from the one main() is in.  The main
  loop is told to end, then unireg_abort() is called.  Its
  de-init and that of main() will then race each other for
  mutex- and cond-var-destroys, free(), and finally exit().
  
  This patch introduces a special case for Windows that will eliminate
  the race by ending the signal-handler via unireg_end() instead if
  SIGINT is signalled.  This seems the least intrusive fix that still
  fixes user-visible behaviour.
parent e066cb33
......@@ -991,7 +991,11 @@ static void __cdecl kill_server(int sig_ptr)
my_thread_init(); // If this is a new thread
#endif
close_connections();
if (sig != MYSQL_KILL_SIGNAL && sig != 0)
if (sig != MYSQL_KILL_SIGNAL &&
#ifdef __WIN__
sig != SIGINT && /* Bug#18235 */
#endif
sig != 0)
unireg_abort(1); /* purecov: inspected */
else
unireg_end();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment