Fix worker process count not respecting MaxProcessCount on high core count machines - #11842
Merged
Merged
Conversation
…count machines When SetProcessCountToNumberOfCpuCores is true, ProcessCount is now clamped to MaxProcessCount using Math.Min instead of raising MaxProcessCount to match the core count. MaxProcessCount should be a hard ceiling that is never overridden. Fixes #8014 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an issue in WorkerConfigurationProviderBase.GetWorkerProcessCount where enabling SetProcessCountToNumberOfCpuCores could effectively override a configured MaxProcessCount on high core-count machines by raising the max to match the detected core count.
Changes:
- Clamp
ProcessCounttoMath.Min(effectiveCores, MaxProcessCount)whenSetProcessCountToNumberOfCpuCoresis enabled. - Update the corresponding unit test assertion to expect the clamped value rather than the raw core count.
- Add a release note entry describing the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/WebJobs.Script/Workers/Rpc/Configuration/WorkerConfigurationProviderBase.cs | Ensures MaxProcessCount remains a hard ceiling when deriving ProcessCount from effective CPU cores. |
| test/WebJobs.Script.Tests/Workers/Rpc/WorkerConfigurationProviderBaseTests.cs | Updates the SetProcessCountToNumberOfCpuCores expectation to match the new clamping behavior. |
| release_notes.md | Documents the fix in the release notes list. |
Covers the case where core count exceeds MaxProcessCount with fixed coresCount values, ensuring the clamping logic is exercised regardless of CI machine core count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
/azp run host.integration-tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Sorry sarah (@satvu) -- put that in the wrong PR... |
Brett Samblanet (brettsam)
approved these changes
Jun 19, 2026
Shyju Krishnankutty (kshyju)
approved these changes
Jun 19, 2026
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.
Summary
Fixes #8014
When
SetProcessCountToNumberOfCpuCoresistrue, theGetWorkerProcessCountmethod was settingProcessCountto the raw core count and then raisingMaxProcessCountto match if cores exceeded the configured max. This meantMaxProcessCountwas silently overridden on high core count machines (e.g., 32+ cores).Changes
WorkerConfigurationProviderBase.cs— replaced the two-line block that setProcessCount = coresCountand conditionally raisedMaxProcessCountwith a single line:MaxProcessCountis now a hard ceiling that is never overridden.WorkerConfigurationProviderBaseTests.cs— updated theGetWorkerProcessCount_Testsassertion to expectMath.Min(coresCount, maxProcessCount)instead of the raw core count, so the test passes correctly regardless of the machine's core count.Testing
All 5
GetWorkerProcessCounttests pass.Checklist
in-procbranch is not requiredrelease_notes.md