停止响应但进程未死时自动重新启动HHVM [英] Automatically restarting HHVM when it stops responding but process not dead

查看:99
本文介绍了停止响应但进程未死时自动重新启动HHVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个问题,即每12-24小时HHVM崩溃一次,但似乎使进程继续运行.看来大多数提供程序只是将php5-fpm用作nginx内的故障转移,以实现稳定性.但是,这不会重新启动无响应的hhvm实例.

I'm having a problem where every 12-24 hours, HHVM crashes but it seems to leave the process running. It seems most providers just use php5-fpm as a failover within nginx for stability. However, this won't restart the non-responsive hhvm instance.

由于该进程仍在运行,因此大多数服务器监视解决方案会将其视为实时守护程序,而不是重新启动它. HTTP监视的响应速度可能很慢.

Since the process is left running, most server monitoring solutions will see it as a live daemon, and not restart it. HTTP monitoring can be slow to react.

是否可以在故​​障转移时触发hhvm重新启动?如果没有,那么确保重启无响应的侦听守护程序的最佳解决方案是什么.

Is it possible to trigger the hhvm restart on failover? If not, what would be the best solution to ensure a listening daemon that's non responsive is restarted.

推荐答案

kristapsk 发布了有关以下方面的官方错误的解决方案:这个话题. 这是他告诉脚本要添加到cron中的脚本,该脚本每2分钟执行一次.

kristapsk posted a solution on Official bug regarding this topic. This is the script he told to add to cron to be executed every 2 minutes.

我对其进行了一些修改,以使其可以与HHVM的预构建软件包一起使用.

I have modified it a bit to make it work with prebuilt packages of HHVM.

#! /bin/bash
PID="`cat /var/run/hhvm/pid`"

if [ "$PID" == "" ]; then
    echo No PID, starting up
    /etc/init.d/hhvm start
else
    if [ "`ps ax -o pid | grep $PID`" == "" ]; then
        echo HHVM PID $PID not running, starting up
        # Stop, just in case, if crashed. Else you would get:
        #  * WARNING: hhvm.83 has already been started
        /etc/init.d/hhvm stop
        /etc/init.d/hhvm start
    fi
fi

这篇关于停止响应但进程未死时自动重新启动HHVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆