• unknown's avatar
    Bug#18235: assertion/crash when windows mysqld is ended with ctrl-c · b5000fba
    unknown authored
    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.
    b5000fba
mysqld.cc 271 KB