Yelp/dumb-init

dumb-init returns 143 error code in docker container

GenaANTG opened this issue · 4 comments

After docker-compose stop beanstalk command container with dumb-init returns 143 exit code.

Dockerfile

FROM alpine:3.14

RUN set -xe && apk add --no-cache dumb-init beanstalkd 

EXPOSE 11300/tcp

STOPSIGNAL SIGTERM

ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/bin/beanstalkd", "-s", "5242880", "-f", "60000"]

CMD ["-b", "/var/log"]

docker-compose stop beanstalk

Screenshot 2021-10-17 at 05 22 09

docker-compose exec beanstalk ps aux

Screenshot 2021-10-17 at 05 26 51

PID 1 is correct, dumb-init should catch the signals.

this seems correct to me, dumb-init receives the TERM, sends it along to its subprocesses and then exits with whatever code they have (which most often will be 143 "exited due to unhandled TERM").

here's a small example using sleep:

$ dumb-init -vvv sleep 10000; echo $?
[dumb-init] Detached from controlling tty, but was not session leader.
[dumb-init] Child spawned with PID 20277.
[dumb-init] Unable to attach to controlling tty (errno=1 Operation not permitted).
[dumb-init] setsid complete.
[dumb-init] Received signal 15.
[dumb-init] Forwarded signal 15 to children.
[dumb-init] Received signal 17.
[dumb-init] A child with PID 20277 was terminated by signal 15.
[dumb-init] Forwarded signal 15 to children.
[dumb-init] Child exited with status 143. Goodbye.
143

(note that in the other terminal I ran kill -TERM 123123 where 123123 is the pid of dumb-init

you can further validate by running dumb-init with more --verbose flags

@asottile Thanks mate! I have already complete read the documentation. I missed a point is that dumb-init catch the signals and forwards them to children processes. Looks like problem is still with beanstalkd, so i need write simple wrapper.

My old report: beanstalkd/beanstalkd#527

I think it is exiting? are you sure?

@asottile Yes, it's an old beanstalkd bug.