[NO-TICKET] Fix profiler flaky test #3806
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.
What does this PR do?
This PR fixes a flaky test introduced by #3792:
Specifically, the first test failed due to 4d7cbce -- the profiler was able to "keep up" with the allocation rate of the Ruby VM and never had to skip samples.
The second test then failed because the first test leaked the
thread_that_allocates_as_fast_as_possible
. For the second test, we require that the Ruby VM is fully idle for a certain period, and the leaked thread never allowed the Ruby VM to be idle.The debug output from the second test (this test already has a bunch of extra custom output on failure since it has flaked in the past, although not always by its fault) showed this:
E.g. you can see that the thread started by the other spec was hot on the cpu (lots of
cpu-time
) and that's why the Ruby VM was not idle.Motivation:
The profiler aims for zero flaky tests always! If you find a flaky test in the profiler, I don't know about it, please do let me know :)
Additional Notes:
Interestingly, our leaked threads detector did flag this issue:
...I somewhat wish we were already 100% clean of leaked threads so that we could make a thread leak an instant test suite failure.
How to test the change?
Validate that CI is beautiful green.