Page MenuHomePhabricator

Why do my daemons keep <dying> ?
OpenPublic

Asked by alawson on May 25 2016, 10:16 PM.

Details

I have installed an init script (below) and my daemons start with this script just fine. I can also start them manually. However, the consistently die after around 5 minutes. After this happens, I naturally get the "You have an unresolved setup issue..." and Phabricator reports that my daemons are dead. If I do a phd status, I get something like this:

Log Daemon       Host      Overseer Started                 Class                                       Arguments
363 282720:fjp6a localhost 282720   May 25 2016, 5:50:28 PM <DEAD> PhabricatorRepositoryPullLocalDaemon
364 282720:gpdw4 localhost 282720   May 25 2016, 5:50:28 PM <DEAD> PhabricatorTriggerDaemon
365 282720:hu7io localhost 282720   May 25 2016, 5:50:28 PM <DEAD> PhabricatorTaskmasterDaemon

Everything else seems to be working fine. The system is running CloudLinux (CentOS 6.8) and it's in its own account with a ton of resources given to it. I do have root access, but I like to keep everything in the server isolated as much as possible.

I check the logs and they say:

[25-May-2016 18:05:01 America/New_York] [2016-05-25 18:05:01] ERROR 8: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush at [/home/kmdgdev/public_html/libphutil/src/daemon/PhutilDaemon.php:246]
[25-May-2016 18:05:01 America/New_York] arcanist(head=master, ref.master=c58f1b9a2507), phabricator(head=master, ref.master=0b5ab2330d99), phutil(head=master, ref.master=180f0999d094)
[25-May-2016 18:05:01 America/New_York]   #0 ob_end_flush() called at [<phutil>/src/daemon/PhutilDaemon.php:246]
[25-May-2016 18:05:01 America/New_York]   #1 PhutilDaemon::endStdoutCapture() called at [<phutil>/src/daemon/PhutilDaemon.php:95]
[25-May-2016 18:05:01 America/New_York]   #2 PhutilDaemon::__destruct()
[25-May-2016 18:05:02 America/New_York] [2016-05-25 18:05:02] ERROR 8: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush at [/home/kmdgdev/public_html/libphutil/src/daemon/PhutilDaemon.php:246]
[25-May-2016 18:05:02 America/New_York] arcanist(head=master, ref.master=c58f1b9a2507), phabricator(head=master, ref.master=0b5ab2330d99), phutil(head=master, ref.master=180f0999d094)
[25-May-2016 18:05:02 America/New_York]   #0 ob_end_flush() called at [<phutil>/src/daemon/PhutilDaemon.php:246]
[25-May-2016 18:05:02 America/New_York]   #1 PhutilDaemon::endStdoutCapture() called at [<phutil>/src/daemon/PhutilDaemon.php:95]
[25-May-2016 18:05:02 America/New_York]   #2 PhutilDaemon::__destruct()
[25-May-2016 18:05:03 America/New_York] [2016-05-25 18:05:03] ERROR 8: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush at [/home/kmdgdev/public_html/libphutil/src/daemon/PhutilDaemon.php:246]
[25-May-2016 18:05:03 America/New_York] arcanist(head=master, ref.master=c58f1b9a2507), phabricator(head=master, ref.master=0b5ab2330d99), phutil(head=master, ref.master=180f0999d094)
[25-May-2016 18:05:03 America/New_York]   #0 ob_end_flush() called at [<phutil>/src/daemon/PhutilDaemon.php:246]
[25-May-2016 18:05:03 America/New_York]   #1 PhutilDaemon::endStdoutCapture() called at [<phutil>/src/daemon/PhutilDaemon.php:95]
[25-May-2016 18:05:03 America/New_York]   #2 PhutilDaemon::__destruct()

Inside my daemon (while it's running):

{"pid":282720,"start":1464213028,"config":{"daemonize":true,"log":"\/home\/kmdgdev\/phab.working\/var\/tmp\/phd\/log\/daemons.log","piddir":"\/home\/kmdgdev\/phab.working\/var\/tmp\/phd\/pid","daemons":[{"class":"PhabricatorRepositoryPullLocalDaemon"},{"class":"PhabricatorTriggerDaemon"},{"class":"PhabricatorTaskmasterDaemon","autoscale":{"group":"task","pool":7,"reserve":0}}]},"daemons":[{"pid":282722,"id":"282720:fjp6a","config":{"class":"PhabricatorRepositoryPullLocalDaemon","argv":[],"autoscale":[]}},{"pid":282723,"id":"282720:gpdw4","config":{"class":"PhabricatorTriggerDaemon","argv":[],"autoscale":[]}},{"pid":282724,"id":"282720:hu7io","config":{"class":"PhabricatorTaskmasterDaemon","autoscale":{"group":"task","pool":7,"reserve":0},"argv":[]}}]}

/etc/init.d/phd :

#!/bin/sh
### BEGIN INIT INFO
# Provides: phd
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO
# phabricator-phd      Wrapper above the phabricator-phd daemon (for CentOS 6.x)
#
# chkconfig: 2345 90 90

# Source function library.
. /etc/init.d/functions

start() {
        echo -n "Starting phabricator PHD daemon: "
        su - root -s /bin/sh -c '/home/kmdgdev/public_html/phabricator/bin/phd start'
	stat=$?
        touch /var/lock/subsys/phabricator-phd
        return $stat
}

stop() {
        echo -n "Shutting down Phabricator PHD daemon: "
        su - root -s /bin/sh -c '/home/kmdgdev/public_html/phabricator/bin/phd stop'
	stat=$?
        rm -f /var/lock/subsys/phabricator-phd
        return $stat
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
       su - root -s /bin/sh -c '/home/kmdgdev/public_html/phabricator/bin/phd status'
        ;;
    restart)
        stop
        start
        ;;
    reload)
        restart
        ;;
    *)
        echo "Usage: phabricator-phd {start|stop|status|reload|restart"
        exit 1
        ;;
esac
exit $?

New Answer