Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supervisord exit when reaping unmanaged process #936

Open
stdavy opened this issue May 18, 2017 · 2 comments
Open

supervisord exit when reaping unmanaged process #936

stdavy opened this issue May 18, 2017 · 2 comments

Comments

@stdavy
Copy link

stdavy commented May 18, 2017

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
Copy link
Member

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
Copy link
Author

stdavy commented May 19, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants