Skip to content

test: allow coverage data lock in blockbuster - #1828

Merged
bdraco merged 1 commit into
masterfrom
fix-blockbuster-coverage-lock
Aug 28, 2026
Merged

bdraco merged 1 commit into
masterfrom
fix-blockbuster-coverage-lock

Conversation

@bdraco

@bdraco bdraco commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

test_update_record flaked on windows 3.12 with BlockingError: Blocking call to lock.acquire inside _ServiceBrowserBase._async_start; the acquire came from coverage's C tracer (coverage/collector.py lock_data), which grabs its data lock from whatever frame is running when tracing starts on a new thread, so the browser callback died, no service was added, and the browser threads leaked into teardown.

Details

  • blockbuster only flags a contended Lock.acquire; the race needs another thread holding coverage's data lock at the moment the tracer fires in an event loop frame, which is why it only shows up occasionally
  • the fixture now allowlists threading.Lock.acquire and acquire_lock when the frame is lock_data in coverage/collector.py; blockbuster normalizes frame paths with as_posix, so the match also works on windows

Test plan

  • simulated coverage's frame with a compiled coverage/collector.py filename and a held lock; without the fix it raises BlockingError, with the fix it is allowed, and a contended acquire from any other frame still raises
  • tests/services/test_browser.py passes locally

@codspeed

codspeed Bot commented Aug 28, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing fix-blockbuster-coverage-lock (7212ec1) with master (0b697b7)

Open in CodSpeed

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.81%. Comparing base (0b697b7) to head (7212ec1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1828   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          33       33           
  Lines        3799     3799           
  Branches      543      543           
=======================================
  Hits         3792     3792           
  Misses          5        5           
  Partials        2        2           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bdraco
bdraco marked this pull request as ready for review August 28, 2026 20:04
@bdraco
bdraco merged commit ca9d027 into master Aug 28, 2026
34 checks passed
@bdraco
bdraco deleted the fix-blockbuster-coverage-lock branch August 28, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant