File: thread-initialization-semaphore.patch

package info (click to toggle)
firebird3.0 3.0.12.ds7-13%2Bdeb13u1
  • links: PTS, VCS
  • area: main
  • in suites: trixie, trixie-proposed-updates
  • size: 42,692 kB
  • sloc: ansic: 374,403; cpp: 319,894; pascal: 14,530; sql: 14,345; yacc: 7,556; fortran: 5,645; sh: 5,336; makefile: 1,041; perl: 194; sed: 83; awk: 76; xml: 19; csh: 15
file content (25 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
commit 49e38630499cdab70bc15c255c89fc38048a57a9
Author: TreeHunter <60896014+TreeHunter9@users.noreply.github.com>
Date:   Fri Jan 10 09:30:26 2025 +0300

    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>

--- a/src/yvalve/why.cpp
+++ b/src/yvalve/why.cpp
@@ -804,11 +804,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()