• Vladislav Vaintroub's avatar
    Bug #20430 mysqld.exe windows service stuck in "SERVICE_STOP_PENDING" · ea0efe45
    Vladislav Vaintroub authored
    status
    
    The problem appears to be a race condition, when service is being
    stopped right after startup. We set the service status to SERVICE_RUNNING
    way too early it cannot yet handle stop requests -  initialization has
    not finished and  hEventShutdown  that signals server to stop is not yet
    created. If somebody issues "net stop MySQL" at this time, MySQL is not
    informed about the stop and continues to run as usual, while
    NTService::ServiceMain() stucks forever waiting for mysql's "main" thread
    to finish.
    
    Solution is to remain in SERVICE_START_PENDING status until after server
    initialization  is fully complete and only then change the status to
    SERVICE_RUNNING. In  SERVICE_START_PENDING we do not accept service control
    requests, i.e it is not possible to stop service in that time.
    ea0efe45
mysqld.cc 288 KB