Repository navigation
Fix OS-level thread priority degradation in InProcess executors - #3282
Merged
Merged
Conversation
timcassell
reviewed
Oct 2, 2026
cloudsealed
force-pushed
the
feature/issue-2706
branch
from
October 3, 2026 00:04
70bfd18 to
b81cb44
Compare
Contributor
Author
|
Good catch @timcassell! Rebased onto master and removed the unrelated PhysicalMemoryInfo changes. The PR now contains only the thread priority fix. |
timcassell
approved these changes
Oct 5, 2026
timcassell
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @cloudsealed.
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.
Fixes #2706.
When running
InProcessbenchmarks (withInProcessEmitExecutororInProcessNoEmitExecutor), the benchmark elevates process and thread priority viaTrySetPriorityand then aggressively restores the previous priority in afinallyblock.However,
TrySetPrioritysuppressesWin32Exceptionwhen the elevation fails (which is common on Linux/Unix systems withoutCAP_SYS_NICEwhereProcessPriorityClass.Highmaps to-11nice).As a result, if the user starts the benchmark with a slightly elevated priority (e.g.
nice -n -1), the elevation silently fails, but the restoration toProcessPriorityClass.Normal(mapped to0nice) succeeds, permanently degrading the process and thread priority for all subsequent benchmark runs.This PR fixes the issue by capturing the boolean success result of
TrySetPriorityand ensuring we only attempt to restore the priority if the initial elevation actually succeeded.