Open
Fix thread-count runaway in GC/Scenarios/THDChaos test#131832
Conversation
|
Azure Pipelines: 16 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: VSadov <8218165+VSadov@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix test failure in GC/Scenarios/THDChaos
Fix thread-count runaway in GC/Scenarios/THDChaos test
Aug 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/tests/GC/Scenarios/THDChaos/livingobject.cs:30
- The log uses a volatile read for the
%100check but printsiCountervia a separate non-volatile read. Since other threads can increment between the check and the write, this can print non-multiples of 100 (and generally misreport the value that triggered the log). Capture the value once and use it for both the modulo check and the output.
if( Volatile.Read( ref iCounter )%100 == 0)
{
Console.Out.WriteLine( iCounter + " number of threads has been started" );
}
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @VSadov |
VSadov
marked this pull request as ready for review
August 4, 2026 22:42
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
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.
THDChaosintermittently fails withOutOfMemoryExceptionfromThread.Start— the test creates hundreds of native threads in a burst, which exhausts resources on Arm32's constrained address space.The bound on successor threads was also ineffective:
iCounterisstatic, but the increment tooklock(this), and everyLivingObjecthas a differentthis. Increments were lost and theiCounter < iThrdcheck raced, so more threads were spawned than intended.Changes
livingobject.cs—IncreatCountusesInterlocked.Incrementand returns the new value. The successor thread is started only when that increment reserved a slot, making the cap a genuine bound rather than a racy check:The logging read of
iCounterusesVolatile.Read.thdchaos.cs— capsiThrdat 5 on Arm32, consistent with how other thread-heavy tests are throttled there.