Skip to content
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

[PROF-10422] Fix flaky spec in profiler due to race #3934

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Sep 20, 2024

What does this PR do?

This PR fixes a flaky spec introduced by #3929: a spec to check that an error was raised in a background thread implicitly depended on a race (that the background thread ran before the rspec thread did) and thus started failing when the race was lost.

By actually synchronizing with the background thread using the on_failure_proc, we now guarantee that the background thread has the chance to run as expected.

Motivation:

Our goal is to always have zero flaky specs in the profiler!

Additional Notes:

Fixes https://github.com/DataDog/ruby-guild/issues/179

How to test the change?

Validate that CI is still green.

**What does this PR do?**

This PR fixes a flaky spec introduced by #3929: a spec to check that
an error was raised in a background thread implicitly depended on a race
(that the background thread ran before the rspec thread did) and thus
started failing when the race was lost.

By actually synchronizing with the background thread using the
`on_failure_proc`, we now guarantee that the background thread has
the chance to run as expected.

**Motivation:**

Our goal is to always have zero flaky specs in the profiler!

**Additional Notes:**

Fixes DataDog/ruby-guild#179

**How to test the change?**

Validate that CI is still green.
@ivoanjo ivoanjo requested a review from a team as a code owner September 20, 2024 10:53
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.77%. Comparing base (b2e988e) to head (c8d5351).
Report is 47 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3934      +/-   ##
==========================================
+ Coverage   97.75%   97.77%   +0.02%     
==========================================
  Files        1297     1297              
  Lines       77611    77973     +362     
  Branches     3871     3888      +17     
==========================================
+ Hits        75869    76240     +371     
+ Misses       1742     1733       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pr-commenter
Copy link

pr-commenter bot commented Sep 20, 2024

Benchmarks

Benchmark execution time: 2024-09-20 11:30:22

Comparing candidate commit c8d5351 in PR branch ivoanjo/fix-gvl-profling-exception-flaky with baseline commit 3ff7052 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 23 metrics, 2 unstable metrics.

@ivoanjo ivoanjo changed the title [NO-TICKET] Fix flaky spec in profiler due to race [PROF-10422] Fix flaky spec in profiler due to race Sep 20, 2024
@ivoanjo ivoanjo merged commit 8b00268 into master Sep 20, 2024
200 checks passed
@ivoanjo ivoanjo deleted the ivoanjo/fix-gvl-profling-exception-flaky branch September 20, 2024 13:50
@github-actions github-actions bot added this to the 2.4.0 milestone Sep 20, 2024
@ivoanjo ivoanjo added profiling Involves Datadog profiling dev/internal Other internal work that does not need to be included in the changelog dev/testing Involves testing processes (e.g. RSpec) labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/internal Other internal work that does not need to be included in the changelog dev/testing Involves testing processes (e.g. RSpec) profiling Involves Datadog profiling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants