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

Stop container health check also on kill event #1699

Merged
merged 1 commit into from Jan 23, 2017

Conversation

nevalla
Copy link
Contributor

@nevalla nevalla commented Jan 22, 2017

When container is stopped (docker stop <container>), Docker will send container event with status kill. Currently agent will stop container health check worker only with die event.

@nevalla
Copy link
Contributor Author

nevalla commented Jan 22, 2017

@jakolehm @jnummelin Do you see any side effects because of this?

@nevalla
Copy link
Contributor Author

nevalla commented Jan 23, 2017

Hmm... or should we only track kill event?

@jnummelin
Copy link
Contributor

Hmm, stopping health check on both die and kill does not really make sense to me. At least according to Docker event state here moby/moby#12164 (comment), all containers should get die event when they are being stopped. I.e. when you stop a container, you should get events kill-> die -> stop.

@SpComb
Copy link
Contributor

SpComb commented Jan 23, 2017

It definitely makes more sense to stop health-checking on kill, because the process may stop responding to health checks while shutting down, and we don't want to restart it while it's shutting down... Consider a process that traps the SIGTERM signal, closes its listening socket, waits for any pending transactions to complete, and flushes out any write buffers before exiting... it may take an arbitrarily long time between the Docker kill and the die events (assuming that die = the container pid=1 process has exited).

Even with the kill coming before the die, the Kontena::Workers::ContainerHealthCheckWorker is still racy with the Kontena::ServicePods::Stopper/Terminator, though... the agent should not be health-checking once it has stopped the container, but this process currently relies on the Docker::Container.stop -> Docker event -> Celluloid::Notifications container:event -> Celluloid::Actor.kill chain completing before the ContainerHealthCheckWorker periodic interval kicks in, and that's just a question of timing.

@jakolehm jakolehm added this to the 1.1.0 milestone Jan 23, 2017
@@ -11,7 +11,7 @@ class HealthCheckWorker
finalizer :terminate_workers

START_EVENTS = ['start']
STOP_EVENTS = ['die']
STOP_EVENTS = ['die', 'kill']
ETCD_PREFIX = '/kontena/log_worker/containers'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm stale copy-pasta :)

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

Successfully merging this pull request may close these issues.

None yet

5 participants