关于 supervisor 的 autorestart 为 unexpected 时(默认值)的行为好奇怪,是我理解错了文档了吗? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
love
V2EX    Linux

关于 supervisor 的 autorestart 为 unexpected 时(默认值)的行为好奇怪,是我理解错了文档了吗?

  •  
  •   love Jul 13, 2014 7463 views
    This topic created in 4308 days ago, the information mentioned may be changed or developed.
    设startsecs=1, startretries=3(都是默认值),如果有一程序有这些行为:

    a) 启动即退出,exit code为0, 那么supervisor会在重试3试后停止重试,进程状态为FATAL。
    b) 启动即退出,exit code为1, 那么supervisor会在重试3试后停止重试,进程状态为FATAL。
    c) 启动3秒后退出,exit code为1, 那么supervisor会无限重启程序,无视startretries。
    d) 启动3秒后退出,exit code为0, 那么supervisor不会重启,进程状态为EXIT。

    abd都是预期行为,为什么c会无限重启呢?这好象不太合理啊?非正常退出不是应该重启3次吗?


    supervisor是debian 7自带的。

    autorestart

    May be one of false, unexpected, or true. If false, the process will never be autorestarted. If unexpected, the process will be restart when the program exits with an exit code that is not one of the exit codes associated with this process’ configuration (see exitcodes). If true, the process will be unconditionally restarted when it exits, without regard to its exit code.
    3 replies    2016-03-23 18:11:47 +08:00
    love
        1
    love  
    OP
       Jul 13, 2014
    我操果然写出来才是理解问题的最好方式吗,刚发出来就马上理解了supervisor这么做的合理性了。
    试想一个程序会随机崩掉(比如每隔几天内存用光退出,这时exit code不为0),那种情况下是应该无限重启的,因为程序运行时间已经过了startsecs,认为是正常运行了,这时运行失败和启动不能运行失败是不同的性质。
    fising
        2
    fising  
       Mar 23, 2016
    谢谢,我也是看了你贴的东西顿悟了。
    fising
        3
    fising  
       Mar 23, 2016
    a 和 b 是启动未成功,重试启动 3 次(默认);
    c 是正常启动,但是未正常结束。所以不断重试。
    d 是正常启动,正常退出。不重试。
    About     Help     Advertise     Blog     API     FAQ     Solana     5233 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 39ms UTC 03:32 PVG 11:32 LAX 20:32 JFK 23:32
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86