8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 15:23:03 +01:00

Fix race in shutdown thread start (#8380)

Previously we assign value to shutdownSemaphore after shutdownThread is started, where it is already needed. So we can have situation where shutdownThread instantly leaving due to shutdownSemaphore == nullptr, and we are left with a server that can only be stopped with kill -9.

Co-authored-by: Artyom Ivanov <artyom.ivanov@red-soft.ru>
This commit is contained in:
TreeHunter 2025-01-10 09:30:26 +03:00 committed by GitHub
parent 81bba14984
commit b4e2ea4db3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -831,11 +831,11 @@ private:
explicit CtrlCHandler(MemoryPool& p)
: ShutdownInit(p)
{
shutdownSemaphore = &semaphore;
Thread::start(shutdownThread, 0, 0, &handle);
procInt = ISC_signal(SIGINT, handlerInt, 0);
procTerm = ISC_signal(SIGTERM, handlerTerm, 0);
shutdownSemaphore = &semaphore;
}
~CtrlCHandler()