Uploaded image for project: 'Traffic Control'
  1. Traffic Control
  2. TC-158

daemonize() leaves parent process with bad SIGCHLD handler

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0, 1.8.0, 1.7.0
    • 2.0.0
    • Traffic Ops
    • None

    Description

      Daemon::daemonize() was created to allow a process to run sub-processes in the background, without waiting for their immediate termination.
      In order for terminated processes to be reaped and not become zombies, the SIGCHLD handler in the parent should be set to IGNORE.

      However, doing so in a standard process prevents it from reliably running waitpid(), so many operations that involve forking and waiting for the forked process return code (Such as: Sending e-mail, generating SSL keys, and any functionality using UI::Utils->exec_command() ) become unreliable.

      The problem is not easily noticed, since daemonize is currently called only by API::Cdn::dnssec_keys_refresh(), which is being called twice every 5 minutes. Since there are 96 TO workers by default, it takes a few hours until most of the workers get contaminated with a bad SIGCHLD handler.

      A proper solution is to use double forking in daemonize().

      Attachments

        Issue Links

          Activity

            People

              shemesh Oren Shemesh
              shemesh Oren Shemesh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: