-
Notifications
You must be signed in to change notification settings - Fork 351
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
Fluentd containers do not stop gracefully #92
Comments
ghost
mentioned this issue
Aug 1, 2017
Merged
Seems related to #86. |
Thank you for fixing this! I see that build It looks as though the other images are fixed. I spot checked
|
It seems the problem is installing gosu.
But I'm not sure why only v0.14-debian / v0.14-debian-onbuild have this problem... |
Rebuild images until success resolves build error. Closed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a container using any of the images
v0.12.39
,v0.12.39-debian
,v0.14.20-debian
andv0.14.20-debian
is stopped, thefluentd
process inside receives aSIGKILL
. It does not terminate gracefully. It does not wait for buffers to flush. When stoppedfluentd
should receiveSIGTERM
, terminate gracefully, flush it's buffers and kick a goal.Today I set out to verify that when I configure
flush_at_shutdown true
, I can see that my buffer was flushed. I was not able to observe this! Why?Q. What does the container's process tree look like?
Let's create a simple
fluentd
container:And ask it to print it's process tree:
There are two
sh
processes between PID 1 and fluentd. Maybe SIGTERM is not being forwarded correctly.Q. What signals are processes in our container getting when we stop it?
Let's start the container again:
And list the processes inside:
Now we'll trace signals for all the processes in the container:
Let's stop the container again:
Now we can inspect the
strace
output:We can see that most of the processes in the container actually get a
SIGKILL
when we stop the container. Most importantly, thefluentd
processes receivedSIGKILL
.Q. Why are the
fluentd
processes receiving SIGKILL?It looks like
dumb-init
is forwarding on theSIGTERM
, but the shell scripts it has forked have not. I guess it's because the shell scripts weren't made to forward signals likedumb-init
was.The first shell script is
/bin/entrypoint.sh
. It doesn't contain any signal handling code.The second shell script comes from the container image's command:
This doesn't have any signal handling code either.
Both of these shell scripts seem to only needed when bootstrapping the
fluentd
process, so it would be fine for them toexec
and be replaced by their children. This is whatdumb-init
's README recommends.Q. What other images does this issue affect?
fluent/fluentd:v0.12.39-debian
confirmed:fluent/fluentd:v0.14.20-debian
confirmed:fluent/fluentd:v0.14.20
confirmed:The text was updated successfully, but these errors were encountered: