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

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

    [ https://issues.apache.org/jira/browse/TC-158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15874446#comment-15874446 ] 

ASF GitHub Bot commented on TC-158:
-----------------------------------

GitHub user oren-shemesh opened a pull request:

    https://github.com/apache/incubator-trafficcontrol/pull/295

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

    [TC-158] daemonize() leaves parent process with bad SIGCHLD handler
    
    Renamed daemonize() to fork_and_daemonize() to make it clear that caller should
    expect the function to return twice
    Use double fork in fork_and_daemonize() so parent SIGCHLD handler is not affected


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/oren-shemesh/incubator-trafficcontrol no-ignore-sigchld

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafficcontrol/pull/295.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #295
    
----
commit 5378ae82610fc75863158136276fed8c4fae5b67
Author: Oren Shemesh <or...@qwilt.com>
Date:   2017-02-08T06:06:55Z

    Fixed bad configuration in traffic_ops/app/conf/production/influxdb.conf,
    preventing graphs from being shows in the portal, on production systems.
    
    Now this file is consistent with it's sibling in test/ and development/.

commit 209f1a680a5246e56a18717814f50cd8bfac82e2
Author: Oren Shemesh <or...@qwilt.com>
Date:   2017-02-20T10:39:58Z

    [TC-158] daemonize() leaves parent process with bad SIGCHLD handler
    
    - Renamed daemonize() to fork_and_daemonize() to make it clear that caller should
      expect the function to return twice
    
    - Use double fork so parent SIGCHLD handler is not affected

commit 0af57f9b7d17cd8267a7a94f80f6cbb308776762
Author: Oren Shemesh <or...@qwilt.com>
Date:   2017-02-20T12:01:06Z

    Merge remote-tracking branch 'official/master' into no-ignore-sigchld

commit 6897ceee7c07f4d75e4aac8a744e721255d2232d
Author: Oren Shemesh <or...@qwilt.com>
Date:   2017-02-20T12:09:18Z

    As part of the fix to TC-158, remove previous fix, which is not needed any more

----


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