If you follow along the rtcamp tutorial for installing HHVM on Ubuntu and use the apt-get install, HHVM is installed with an init.d script that will start and stop the daemon, but does not re-start it if it crashes. The install also did not (for me on 14.04) run the rc script to make the daemon start up on boot.
In my testing, I found that the daemon was crashing sometimes and then things slowed down considerably on the site because first nginx would try to send the request to HHVM and then it would wait 10 seconds for it to time out and then it would send the request to php-fpm as a backup. That happens with every request - nginx doesn’t somehow figure out that HHVM is down for the count. I think there are some nginx directives that you can use in the upstream block to make this better, but I thought that the best thing would be to just respawn the HHVM daemon if it crashed.
So I decided to replace the init.d script with a simple upstart script (goes into /etc/init) that would keep an eye on hhvm and respawn if it quit.
First I stopped hhvm:
sudo service hhvm stop
/etc/init/hhvm.conf with the following contents:
UPDATE: see latest script in this gist
Then moved the init.d script out of the way:
sudo mv /etc/init.d/hhvm ~
Then restarted hhvm
sudo service hhvm start
Now upstart is running and supervising the HHVM daemon for you. It will automatically start up on reboot and if it crashes it will respawn for you.
NOTE: read through the rest of this thread for some caveats and updates.