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

cli: forward SIGTERM to child process of 'lock' and 'watch' subcommands #4737

Merged
merged 2 commits into from
Oct 2, 2018

Conversation

rboyer
Copy link
Member

@rboyer rboyer commented Oct 1, 2018

This PR ensures that the consul lock and consul watch subcommands forward the SIGTERM signal to the child process that they supervise.

This also removes the existing forwarding logic for SIGKILL as it's impossible to receive these signals.

Fixes #3754

…ds on unix

This also removes the signal handler for SIGKILL as it's impossible to
receive these signals.
@rboyer rboyer requested a review from a team October 1, 2018 21:43
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

I'll leave someone else to review and approve but this looks awesome! :) Beautiful tests too.


func TestForwardSignals(t *testing.T) {
for _, s := range forwardSignals {
testForwardSignal(t, s)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would wrap each one of these in a subtest t.Run() with the signal name/number.

Copy link
Member Author

Choose a reason for hiding this comment

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

I totally forgot about t.Run. I'll also remove the testname log prefix stuff as it's not needed to understand the failures now.

"syscall"
)

var forwardSignals []os.Signal = []os.Signal{os.Interrupt, syscall.SIGTERM}
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick but I don't think you need the first []os.Signal here. Surprised fmt doesn't remove this actually.

@banks
Copy link
Member

banks commented Oct 2, 2018

This looks good to me although the test fail was 3 consecutive 8/9min timeouts which I've never seen before. I've restarted that job to see if there was just a bad moment for CPUs on Travis when that ran but it's possible that one of these tests actually blocks now because something is not being sent the right signal etc.

Did you see agent package to pass locally?

@banks
Copy link
Member

banks commented Oct 2, 2018

Nevermind it passed on a retry 🎉 🤦‍♂️

@rboyer
Copy link
Member Author

rboyer commented Oct 2, 2018

Updated PR with feedback.

@rboyer rboyer merged commit 491826d into master Oct 2, 2018
@rboyer rboyer deleted the feature/lock-signals-3754 branch October 2, 2018 20:57
@hanshasselberg
Copy link
Member

😍

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

Successfully merging this pull request may close these issues.

4 participants