Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66562

Audit, document all functions accessed by sync signal handlers

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 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)

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: