Supervisor / supervisor

Supervisor process control system for Unix (supervisord)
http://supervisord.org
Other
8.54k stars 1.25k forks source link

supervisord exit when reaping unmanaged process #936

Open stdavy opened 7 years ago

stdavy commented 7 years ago

Hello,

I'm trying to use supervisor + rsyslog + cronie in a docker container. Everything seems to work fine at the beguinning, but actually I realized that my container is stopping after one or two hours without any information the the logs. After many investigations I won't detail here, I realize that I can make my container stop easily with the following script:

#!/bin/sh

function luke () {
        echo "I'm Luke Skywalker"
        sleep 10
        echo "Luke says goodbye"
        exit 0
}

echo "I'm Dark Vador"
luke &
echo "Vador says goodbye"
exit 0

What happens with this script is that its creates a child and exit without reaping the child status. Then when the child stops, it send the SIGCHLD signal to its father which is now supervisord. And that's enough to make supervisor stops, and then my whole container stops.

I think I have something similar with my rsyslogd, I don't what exactly... Here is my supervisor.conf:

[supervisord]
loglevel = info
nodaemon = true

[program:rsyslog]
command=/usr/sbin/rsyslogd -nd -f /etc/rsyslog.conf
process_name=%(program_name)s
numprocs=1
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0

[program:cronie]
command=/usr/sbin/crond -m off -n -s
process_name=%(program_name)s
numprocs=1
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0

So, do you have any idea?

Thanks a lot,

Stéphane

mnaberez commented 7 years ago

What happens with this script is that its creates a child and exit without reaping the child status. Then when the child stops, it send the SIGCHLD signal to its father which is now supervisord. And that's enough to make supervisor stops, and then my whole container stops.

What version of Supervisor are you using?

stdavy commented 7 years ago

Hello,

Thanks for your answer. I use the latest one: 3.3.1. Currently, I have found a workaround using "tini" as my primary init software which then launches supervisord (https://github.com/krallin/tini) . Tini takes in account the sigchld of orphans process, and I still keep the flexibility of supervisord to manage my services. It seems to work like a charm.