File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ [supervisord]
2+ loglevel=debug ; log level; default info; others: debug,warn,trace
3+ logfile=/tmp/issue-733.log ; main log file; default $CWD/supervisord.log
4+ pidfile=/tmp/issue-733.pid ; supervisord pidfile; default supervisord.pid
5+ nodaemon=true ; start in foreground if true; default false
6+
7+ ;
8+ ;This command does not exist so the process will enter the FATAL state.
9+ ;
10+ [program:nonexistent]
11+ command=%(here)s/nonexistent
12+ startsecs=0
13+ startretries=0
14+ autorestart=false
15+
16+ ;
17+ ;The one-line eventlistener below will cause supervisord to exit when any process
18+ ;enters the FATAL state. Based on:
19+ ;https://github.com/Supervisor/supervisor/issues/733#issuecomment-781254766
20+ ;
21+ ;Differences from that example:
22+ ; 1. $PPID is used instead of a hardcoded PID 1. Child processes are always forked
23+ ; from supervisord, so their PPID is the PID of supervisord.
24+ ; 2. "printf" is used instead of "echo". The result "OK" must not have a newline
25+ ; or else the protocol will be violated and supervisord will log a warning.
26+ ;
27+ [eventlistener:fatalexit]
28+ events=PROCESS_STATE_FATAL
29+ command=sh -c 'while true; do printf "READY\n"; read line; kill -15 $PPID; printf "RESULT 2\n"; printf "OK"; done'
30+ startsecs=0
31+ startretries=0
Original file line number Diff line number Diff line change @@ -91,6 +91,15 @@ def test_issue_664(self):
9191 seen = False
9292 self .assertTrue (seen )
9393
94+ def test_issue_733 (self ):
95+ filename = pkg_resources .resource_filename (__name__ , 'fixtures/issue-733.conf' )
96+ args = ['-m' , 'supervisor.supervisord' , '-c' , filename ]
97+ supervisord = pexpect .spawn (sys .executable , args , encoding = 'utf-8' )
98+ self .addCleanup (supervisord .kill , signal .SIGINT )
99+ supervisord .expect_exact ('gave up: nonexistent entered FATAL state' )
100+ supervisord .expect_exact ('received SIGTERM indicating exit request' )
101+ supervisord .expect (pexpect .EOF )
102+
94103 def test_issue_835 (self ):
95104 filename = pkg_resources .resource_filename (__name__ , 'fixtures/issue-835.conf' )
96105 args = ['-m' , 'supervisor.supervisord' , '-c' , filename ]
You can’t perform that action at this time.
0 commit comments