CI Limit ninja number of parallel jobs in CircleCI #30333
Merged
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.
Check this fixes the CircleCI issue see in many PRs for example in #30327 (comment).
Not sure why this started being an issue, my guess is that something changed in CircleCI and ninja thinks he has too many cores instead of the 2 that it should see. ninja ends up creating too many processes and there is some kind of CircleCI job manager that kills the processes. This corroborates what was seen using CircleCI SSH debug with
htop
.Apparently the default number of jobs is number of cores + 2 so I set it to 4 since we have two cores in our CircleCI job. Not sure the rule is so simple after reading a bit more but
-j4
makes the doc build pass so probably good enough.There was this old ninja+CircleCI issue ninja-build/ninja#1530 although I am guessing this is not fully relevant ninja-build/ninja#1530. At least this points to https://github.com/ninja-build/ninja/blob/a3fda2b06c027f19c7ec68c08e21859e44c15cde/src/ninja.cc#L248-L258 that seems to point at the default parallelism rule. TL;DR in general parallelism is number of cores + 2, 3 for 2 cores and 2 for 1 core.