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

Audit, document all functions accessed by sync signal handlers



    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Service Arch
    • ALL
    • Service Arch 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)




            backlog-server-servicearch Backlog - Service Architecture
            billy.donahue@mongodb.com Billy Donahue
            0 Vote for this issue
            7 Start watching this issue