restart_wrapper: Be explicit about what signals are forwarded to entr #626
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
In #586 support for forwarding all signals sent to PID 1 on to
entr
was added. However, it doesn’t fully address the goal of #577, since the developer’s "true" entrypoint isn’t receiving those forwarded signals—onlyentr
is. While this generally works for shutting down child processes, it can also forward unintended signals that breakentr
.A concrete example is when the child process managed by
entr
becomes a zombie and gets re-parented to PID 1. The kernel then sendsSIGCHLD
to PID 1, which in turn forwards it toentr
. These "spurious"SIGCHLD
signals can causeentr
to stop monitoring or restarting the process, breaking therestart_wrapper
functionality.How to Reproduce
kubectl exec
into a pod that usesrestart_wrapper
.kill -SIGCHLD <entr-pid>
.Fix
To keep the spirit of #586 this PR changes the code so that only
SIGKILL
,SIGINT
, andSIGTERM
are forwarded. This prevents unintended signals (likeSIGCHLD
) from being passed toentr
, avoiding the issue whereentr
stops managing its child processes after receiving unexpected signals.