Fix SIGCHLD race in signal handler setup#5210
Merged
lifubang merged 1 commit intoopencontainers:mainfrom Apr 2, 2026
Merged
Conversation
kolyshkin
reviewed
Apr 1, 2026
signals.go
Outdated
| } | ||
| handler := make(chan *signalHandler) | ||
|
|
||
| // ensure that we have a large buffer size so that we do not miss any |
Contributor
There was a problem hiding this comment.
a very minor nit:
Suggested change
| // ensure that we have a large buffer size so that we do not miss any | |
| // Ensure that we have a large buffer size so that we do not miss any |
kolyshkin
reviewed
Apr 1, 2026
signals.go
Outdated
Comment on lines
+37
to
+38
| // setup. | ||
| // But `SIGCHLD` is very important, so we need to handle it immediately. |
Contributor
There was a problem hiding this comment.
Suggested change
| // setup. | |
| // But `SIGCHLD` is very important, so we need to handle it immediately. | |
| - // setup. | |
| + // setup, except for SIGCHLD which is very important (see #5208). |
52e4032 to
b594619
Compare
Contributor
|
I want to include this into 1.5.0rc2, @opencontainers/runc-maintainers ptal |
AkihiroSuda
approved these changes
Apr 1, 2026
Contributor
|
@lifubang feel free to merge as is or modify the comments, either way is fine with me. Once merged, please open an 1.5 backport, I want to release rc2 asap |
When signal installation was moved to a goroutine for performance, containers that exited quickly could complete before SIGCHLD was registered, causing runc to hang waiting for the signal. This fix ensures SIGCHLD is registered immediately in the main thread before other signals are handled in the goroutine, maintaining performance while guaranteeing no missed SIGCHLD notifications for fast-exiting containers. Reported-by: Ayato Tokubi <atokubi@redhat.com> Signed-off-by: lifubang <lifubang@acmcoder.com>
b594619 to
404181e
Compare
This was referenced Apr 2, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an alternative to #5206.
Fix: #5208
When signal installation was moved to a goroutine for performance(#4654), containers that exited quickly could complete before SIGCHLD was registered, causing runc to hang waiting for the signal.
This fix ensures SIGCHLD is registered immediately in the main thread before other signals are handled in the goroutine, maintaining performance while guaranteeing no missed SIGCHLD notifications for fast-exiting containers.
Reported-by: Ayato Tokubi atokubi@redhat.com