Repository navigation
Count a timed out spawn once in max_consecutive_spawn_errors - #236
Merged
hmcguire-shopify merged 2 commits intoNov 19, 2026
Merged
Conversation
bscanlan
force-pushed
the
fix-spawn-timeout-error-count
branch
from
November 19, 2026 18:21
5a43ee4 to
35e1d30
Compare
`hard_timeout` incremented `@consecutive_spawn_errors` for a child that was not ready. When the monitor reaps the killed child, `reap_worker` increments the counter again for the same failure. As a result, the monitor aborted after about half of `max_consecutive_spawn_errors` timeouts. Increment the counter in `hard_timeout` only for a child that never registered. The monitor never reaps such a child. `test_max_consecutive_spawn_timeout` passed only because of the double count: 3 timed out spawns counted as 6, which is more than 4. It now sets the limit to 2, so it still aborts after the first round of spawns.
| @consecutive_spawn_errors += 1 unless child.ready? | ||
|
|
||
| if child.pid.nil? # Not yet registered, likely never spawned | ||
| @consecutive_spawn_errors += 1 unless child.ready? |
Contributor
There was a problem hiding this comment.
I think if the child.pid.nil? then child can never be ready?
hmcguire-shopify
approved these changes
Nov 19, 2026
bscanlan
force-pushed
the
fix-spawn-timeout-error-count
branch
from
November 19, 2026 22:41
35e1d30 to
4aeb56a
Compare
A child without a pid has not sent its spawn message, so it cannot be ready yet.
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.
Why?
The configuration docs say a worker that fails to become ready adds one to the
max_consecutive_spawn_errorscount. A timed out spawn adds two, once when it times out and again when the killed worker is reaped. With a limit of 4 and one worker, the monitor gives up after 3 timed out spawns instead of 5.How?
A timeout now adds to the count only for a worker that never registered, because the monitor never reaps those.
Notes for reviewers
The existing timeout test only passed because of the double count, so its limit drops from 4 to 2. That keeps the abort in the first round of spawns, inside the test's 4 second wait.