You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by "Oren Shemesh (JIRA)" <ji...@apache.org> on 2017/02/20 10:55:44 UTC

[jira] [Created] (TC-158) daemonize() leaves parent process with bad SIGCHLD handler

Oren Shemesh created TC-158:
-------------------------------

             Summary: daemonize() leaves parent process with bad SIGCHLD handler
                 Key: TC-158
                 URL: https://issues.apache.org/jira/browse/TC-158
             Project: Traffic Control
          Issue Type: Bug
          Components: Traffic Ops
    Affects Versions: 1.8.0, 2.0.0, 1.7.0
            Reporter: Oren Shemesh
            Assignee: Oren Shemesh
             Fix For: 2.0.0


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().



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)