-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Make a test scenario less stressful. #121356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Tagging subscribers to this area: @dotnet/gc |
ee575f7 to
a50dd1d
Compare
|
I've rebased/rerun the CI on this PR several times and did not see the issue reproducing. I think this is a sufficient fix for the test issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the reliability and performance of the TestAnotherThread test method in the GC.GetTotalAllocatedBytes test suite.
- Adds an upper bound to the background task's loop to prevent potential infinite loops
- Reduces main thread iterations from 1000 to 100 for faster test execution while maintaining adequate coverage
- Maintains early termination capability when the test completes
agocke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
|
Thanks! |
Test-only fix.
Fixes: #119187
The testcase creates and joins threads in a loop while another thread calls
GetTotalAllocatedBytesand checks various invariants: if the result is not negative, grows over time, ...This is not a stress test. The purpose is just to demonstrate that
GetTotalAllocatedBytesworks in the presence of threads starting and exiting. It does not need to run for very long.Creating/joining threads nonstop appear to cause issues on arm32. Sometimes we see OOMs.
In particular there is a concern that the thread that creates threads + the actual threads may starve the main thread, thus arbitrarily prolonging the scenario.
Thie fix tries to limit the total number of threads that the test creates, making its completion more deterministic.