server: don't panic when a finished compile has neither code nor signal#2776
Open
jetm wants to merge 1 commit into
Open
server: don't panic when a finished compile has neither code nor signal#2776jetm wants to merge 1 commit into
jetm wants to merge 1 commit into
Conversation
get_signal did `status.signal().expect("must have signal")`, assuming the
Unix invariant that an ExitStatus with no exit code was terminated by a
signal. That does not always hold: an ExitStatus reconstructed for a
distributed compile (or an abnormal wait status such as WIFSTOPPED) can
report neither a code nor a signal. When that happened the expect() panicked
the compile task, which the server surfaced as a misleading "Failed to bind
socket" and, under load, repeatedly fell back to local compilation.
Return Option<i32> from get_signal and assign it straight into res.signal, so
a compile that reports neither code nor signal leaves res.signal unset
instead of crashing the in-flight task. The Windows arm returns None rather
than panicking; ExitStatus::code() is always Some there, so the signal branch
is never reached anyway.
Add a unit test covering a real terminating signal (SIGKILL) and the
neither-code-nor-signal case (WIFSTOPPED via from_raw), which previously
panicked.
Signed-off-by: Javier Tia <javier@peridio.com>
(cherry picked from commit b2c46f6a2f48dbae8ac24ec5eefacac7dc124db2)
16 tasks
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.
Part of #2775 (splitting the OpenEmbedded/Yocto sccache-dist work into focused
PRs; replaces the closed #2750).
Problem
get_signaldidstatus.signal().expect("must have signal"), assuming the Unixinvariant that an
ExitStatuswith no exit code was terminated by a signal. Thatdoes not always hold: an
ExitStatusreconstructed for a distributed compile (oran abnormal wait status such as
WIFSTOPPED) can report neither a code nor asignal. When that happened the
expect()panicked the compile task, which theserver surfaced as a misleading "Failed to bind socket" and, under load,
repeatedly fell back to local compilation. Found under a Yocto/BitBake host-mode
distributed build.
Approach
Return
Option<i32>fromget_signaland assign it straight intores.signal,so a compile that reports neither code nor signal leaves
res.signalunsetinstead of crashing the in-flight task. The Windows arm returns
Noneratherthan panicking;
ExitStatus::code()is alwaysSomethere, so the signal branchis never reached anyway.
Test
Adds a unit test covering a real terminating signal (SIGKILL) and the
neither-code-nor-signal case (
WIFSTOPPEDviafrom_raw), which previouslypanicked.