-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Handle SIGTERM when running commands #827
Conversation
Cool! Does this need testing on Windows? I didn't think they had SIGTERM over there. |
Yes, please. I'm hoping that the new line is a harmless no-op on that platform, but I can't say as I don't run Windows. |
Ahh, ok, the question is more "does Windows explode as a result of this patch?" than "is SIGTERM handled properly on Windows?" IIRC, the latter would be impossible to test since Windows doesn't have SIGTERM, but someone with more Windows experience would know for sure. |
It builds on Windows, at least. Usually there's just build failures if something isn't implemented. I'm running the tests now. |
Also FYI |
Mmm, good point @highlyunavailable. If the tests pass, I'll compact the code and update the PR. |
From the look of things this won't break on Windows, there just is no instance in which there will be the The tests failed all sorts of ways but it doesn't look like anything you did. Mostly Raft couldn't start: |
Those tests are failing on the master branch too, so let's see what happens when those are fixed. |
Make Consul treat SIGTERM like it does SIGINT when running commands. This is especially important when running Consul as a daemon, since Unix process managers send SIGTERM to restart or terminate a process. This change is untested on Windows. Fixes hashicorp#797
54f0315
to
1d5c0a2
Compare
Updated commit to use an additional argument to signal.Notify() instead of making another call to it. |
Thanks, @mfischer-zd. We do already have some handling for SIGTERM here. The behavior of SIGTERM is configurable. If what you're after is a graceful leave, you can set the |
@mfischer-zd ah that makes sense then, merging this in. The test failures are definitely unrelated to this change. I'll address those separately. |
Handle SIGTERM when running commands
* Add changelog entry for ingress gw change
Make Consul treat SIGTERM like it does SIGINT when running commands.
This is especially important when running Consul as a daemon, since
Unix process managers send SIGTERM to restart or terminate a process.
This change is untested on Windows.
Fixes #797