-
Notifications
You must be signed in to change notification settings - Fork 134
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
documentation on stopTimeout field is confusing #479
Comments
I think there's a little work required around documenting use cases of // these fields interact with 'when' behaviors (see below)
timeout: "300s",
stopTimeout: "10s",
restarts: "unlimited", @tgross should add to this but
I'll try to get a better use case/example into the docs. |
Another way of putting this is that But the job that's watching for the So if you want to make sure that other job is going to timeout too, then you need to add the jobs: [
{
name: "consul-agent",
exec: "consul agent...",
stopTimeout: "5s"
},
{
name: "leave-consul",
exec: "consul leave",
timeout: "5s",
when: {
source: "consul-agent",
once: "stopping"
}
}
] |
@tgross I need to set the job graceful shutdown time, 5 seconds is too small, is it supported? |
We need something like |
And, IMHO, the default kill timeout should be infinity, so it equals container's timeout, whether managed by docker or kubernetes. If user want to guarantee some downstream job gets executed, they should set the kill timeout of upstream job explicitly. |
That will be problematic in a non-Docker environment though. |
@inetfuture Some time next week I'll take a look and see what this type of feature would require. |
@inetfuture @JeromeGe I had a chance to check out the behavior around the default "5s" timeout and found that we already have a configuration option to change this. It appears ContainerPilot has a global Note the second line in the config below... {
consul: "localhost:8500",
stopTimeout: "15",
logging: {
level: "DEBUG",
format: "text",
},
jobs: [
{
name: "main-process",
exec: "/ubuntu/test-daemon -p 5 -t 30",
restarts: "unlimited",
},
{
name: "main-process2",
exec: "/ubuntu/test-daemon -p 2 -t 20",
restarts: "unlimited",
},
],
control: {
socket: "/tmp/cp-simple.socket",
},
} Using a similar test program as provided by this issue's original author, I've set my job exec processes to pause for shutdown after 30s and another after 20s. A global Here's the log output of this configuration's behavior.
I'm re-opening this issue so I'll remember to update the documentation to reflect this use case at the global/application level. |
By our test, if we set the global |
I agree that it's not ideal, but it's a bit of a tricky situation. At the point where the top-level stop timeout is hit, we're in the following condition:
So at this point, we should be able to exit immediately, but in practice I think we might be able to improve this slightly via #476. |
This is issue is still open because #476 (and PR #512) might bring about the necessary plumbing to support this. When working on #512 I did uncover the area where this could be applied however I never did anything after that. No promises, but worth exploring. If I have the time I'll open a new proposal issue since this issue is more relevant to how CP works today. |
containerpilot --version
Version: 3.3.4
GitHash: f7d6212
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
uname -a
Linux 0743e8140205 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
test.go
The
stopTimeout
field is set to 120s, but thetest-stopTimeout program
is killed after 5 secondstest code: https://github.com/JeromeGe/test-containerpilot-stopTimeout
The text was updated successfully, but these errors were encountered: