[NO-TICKET] Relax profiler expectation to reduce flakiness #3548
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?
We ran into a flaky spec in CI
(https://app.circleci.com/pipelines/github/DataDog/dd-trace-rb/14137/workflows/a609e08c-87bf-48a7-8eb4-4e9a45e01478/jobs/526030):
This is unexpected since (at time of writing) we always increment the counter before triggering a sample, so this should not be possible.
After some head-scratching, I believe this is related to the
rb_postponed_job_register_one
clobbering bug we've had reports before. (See comments for my full reasoning).Thus... I tried to add a small margin to hopefully make sure this flakiness becomes even rarer on the affected Rubies (< 3.3).
Motivation:
Reduce as much as possible flakiness in the profiler test suite.
Additional Notes:
For reference, here's the code for queuing:
https://github.com/ruby/ruby/blob/v3_2_3/vm_trace.c#L1655-L1664
and this is dequeing:
https://github.com/ruby/ruby/blob/v3_2_3/vm_trace.c#L1772-L1780
How to test the change?
It's really hard to trigger this without actually changing Ruby to e.g. trigger the enqueue at the exact time. I didn't spend time on reproducing this exact issue as I'm pretty convinced from looking at the code.
For Datadog employees:
credentials of any kind, I've requested a review from
@DataDog/security-design-and-guidance
.