• Sergey Vojtovich's avatar
    MDEV-10043 - main.events_restart fails sporadically in buildbot (crashes upon · 7f38a070
    Sergey Vojtovich authored
                 shutdown)
    
    There was race condition between shutdown thread and event worker threads.
    
    Shutdown thread waits for thread_count to become 0 in close_connections(). It
    may happen so that event worker thread was started but didn't increment
    thread_count by this time. In this case shutdown thread may miss wait for this
    working thread and continue deinitialization. Worker thread in turn may continue
    execution and crash on deinitialized data.
    
    Fixed by incrementing thread_count before thread is actually created like it is
    done for connection threads.
    
    Also let event scheduler not to inc/dec running threads counter for symmetry
    with other "service" threads.
    7f38a070
event_scheduler.cc 21.9 KB