valhallasw added a comment.

This was the cause: 
https://github.com/phacility/libphutil/blob/master/src/daemon/PhutilDaemon.php#L47

```
   if (!posix_isatty(STDOUT)) {
      posix_kill(posix_getppid(), SIGUSR1);
    }
```

Apparently SIGUSR1 is used to tell the parent process the child is still 
alive... but the default SIGUSR1 action is 'exit'. 


Fixing this with
```
function on_USR1()
{
  echo Received SIGUSR1
}

trap on_USR1 USR1
```

means the process doesn't disappear anymore, but the bot is also not killed 
with qdel. Why did the Phabricator team decide to re-invent the wheel...?

Few other options I've tried:
 - script. Doesn't work at all.
 - script-with-screen. Same
 - using phd with an on_EXIT handler:

```
function on_EXIT()
{
  echo Stopping all daemons...
  phabricator/bin/phd stop
  echo Done.
}

function on_USR1()
{
  echo Received SIGUSR1
}

trap on_USR1 USR1
trap on_EXIT EXIT

echo Starting daemon via PHD!
phabricator/bin/phd launch phabricatorbot `pwd`/phab_config.json
echo Started. Sleep for ALL times!
```

Starting works, killing doesn't.

TASK DETAIL
  https://phabricator.wikimedia.org/T573

REPLY HANDLER ACTIONS
  Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign 
<username>.

To: valhallasw
Cc: wikibugs-l, Aklapper, chasemp, mmodell, Qgil, Dzahn, greg, Legoktm, Elitre, 
valhallasw, Eloquence, Liuxinyu970226, Ladsgroup, Jdforrester-WMF, scfc, Revi, 
jeremyb



_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to