-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add Signal Forwarding to Entrypoint Runner #2426
Conversation
170d5be
to
fcb1bea
Compare
Nice! Can you add to the release notes section of the PR since I think this is something we'll want to call out in the next release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any kind of test case we can add with this change to demonstrate that it works, and prevent regressions in future changes?
83842eb
to
3f58719
Compare
3f58719
to
430f729
Compare
430f729
to
bd8299e
Compare
/test pull-tekton-pipeline-integration-tests |
|
bd8299e
to
49abf13
Compare
|
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-integration-tests |
2 similar comments
/test pull-tekton-pipeline-integration-tests |
/test pull-tekton-pipeline-integration-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/meow
/cc @afrittoli @bobcatfish @sbwsg
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
for s := range rr.signals { | ||
// Forward signal to main process and all children | ||
if s != syscall.SIGCHLD { | ||
_ = syscall.Kill(-cmd.Process.Pid, s.(syscall.Signal)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious - why do we negate cmd.Process.Pid here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If PID given is negative, then the signal is sent to the process (with the same PID) as well as all it's children. This ensures signal forwarding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vdemeester @imjasonh this seems pretty much ready to go, any objections on your end?
Thanks for pinging @bobcatfish, the PR lgtm but I'll hold off in case others have questions. |
The Entrypoint process should be notified and signals received should be propogated as necessary. This signal forwarding mimics the one in https://github.com/pablo-ruth/go-init which is an golang implementation of https://github.com/Yelp/dumb-init . The cmd.Run() has also been replaced with a cmd.Start() and cmd.Wait() to systematically start the command and Wait for it's completion without prematurely exiting.
49abf13
to
4ecb74c
Compare
The following is the coverage report on the affected files.
|
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Thanks @waveywaves !!
// TestRealRunnerSignalForwarding will artificially put an interrupt signal (SIGINT) in the rr.signals chan. | ||
// The chan will not be reinitialized in the runner considering we have already initialized it here. | ||
// Once the sleep process starts, if the signal is successfully received by the parent process, it | ||
// will interrupt and stop the sleep command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding the docstring!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:3
This PR cannot be merged: expecting exactly one kind/ label Available
|
/kind feature |
The Entrypoint process should be notified and signals
received should be propogated as necessary. This signal
forwarding mimics the one in
https://github.com/pablo-ruth/go-init which is an golang
implementation of https://github.com/Yelp/dumb-init .
The cmd.Run() has also been replaced with a cmd.Start()
and cmd.Wait() to systematically start the command
and Wait for it's completion without prematurely exiting.
Changes
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task to build and release this image.
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes