Skip to content

Commit 49e3863

Browse files
TreeHunter9Artyom Ivanov
authored andcommitted
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 <[email protected]>
1 parent e24e0d3 commit 49e3863

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/yvalve/why.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -831,11 +831,11 @@ class ShutdownInit
831831
explicit CtrlCHandler(MemoryPool& p)
832832
: ShutdownInit(p)
833833
{
834+
shutdownSemaphore = &semaphore;
834835
Thread::start(shutdownThread, 0, 0, &handle);
835836

836837
procInt = ISC_signal(SIGINT, handlerInt, 0);
837838
procTerm = ISC_signal(SIGTERM, handlerTerm, 0);
838-
shutdownSemaphore = &semaphore;
839839
}
840840

841841
~CtrlCHandler()

0 commit comments

Comments
 (0)