• Sergey Vojtovich's avatar
    MDEV-7177 - Server hangs on shutdown after InnoDB error (main.plugin_loaderr · 32b0b643
    Sergey Vojtovich authored
                fails in buildbot)
    
    There was a race condition in timer functionality of query timeouts.
    
    Race was as following:
    main thread:          init_thr_timers()
    timer handler thread: my_thread_init()
    main thread:          end_thr_timer()/timer_thread_state= ABORTING
    timer handler thread: timer_thread_state= RUNNING, continue normal op
    main thread:          waits indefinitely for timer handler thread to go down
    
    The original idea of the fix is to set RUNNING state in main thread, before
    starting timer handler thread. But it didn't survive further cleanups:
    - removed "timer_thread_state" and used "thr_timer_inited" for this purpose
    - removed unused "timer_thread_running"
    - removed code responisble for "timer handler thread" shutdown synchronization,
      use pthread_join() instead.
    32b0b643
thr_timer.c 14.4 KB