-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Service Arch
-
SP Prioritized List
Signal handlers for sync signals (SIGSEGV etc) are making calls to diagnostic functions like printStackTrace, setBreakpoint, etc, or even LOGV2 macros. There's a possibility that these functions could make blocking calls or try to acquire resources that the call thread already holds, yielding a deadlock or undefined behavior.
We should make sure that any library calls (logging, stacktracing, etc) used from a signal handler are clearly marked as safe for that purpose. If there's an alternative no-resource path into those libraries (e.g. new "emergency logging" calls, or printStackTrace(mallocFreeOStream), we should audit the call path from the signal handler to make sure it's using those more conservative functions.
We should clearly mark those functions as being called from signal handlers to prevent them from using inappropriate functions. This includes their error paths, which can't e.g. use LOGV2 to report errors. There should be a central block of documentation describing these restrictions in the signal_handlers_synchronous.cpp file.
Changes to these functions should proactively seek to Cc the appropriate context-holding reviewers, as they could introduce subtle side effects.
(split from SERVER-63843)
- is related to
-
SERVER-82459 Fall back to default signal handler when a thread receives two signals
- Closed
- related to
-
SERVER-83271 Make synchronous signal handlers signal-safe
- Open
- split from
-
SERVER-63843 Don't allow recursive doLog in synchronous signal handlers
- Closed