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

Signals ignored on macOS will not be pending

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • Fully Compatible
    • ALL
    • Programmability 2024-10-14, Programmability 2024-10-28, Programmability 2024-11-11

      Our signal handler setup code both blocks SIGHUP and sets the signal action of SIGHUP to SIG_IGN. One would expect that blocking a signal would come before the "ignore" signal disposition, and that if a SIGHUP were sent to the mongo process, the blocking would cause the SIGHUP to become pending, and later recognized by the async signal handler's sigwait. This is what normally happens.

      On macOS, the manual states that "If sa_handler is set to SIG_IGN current and pending instances of the signal are ignored and discarded." This means that SIGHUP sent to the process will be ignored and never be handled. The commit which adds this code is very old and I think we can just discard the code that sets SIG_IGN for the signals we care about.

      An example is that on macOS, when sending kill -s SIGHUP $(pidof mongod), mongod processes do nothing.

      This looks like it's also relevant for SIGUSR2, which is ignored and blocked.

            Assignee:
            alex.li@mongodb.com Alex Li
            Reporter:
            alex.li@mongodb.com Alex Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: