test: Join thread in continuous profiler test #6125
+8
−2
Merged
@sentry/warden / warden: find-bugs
completed
Apr 22, 2026 in 56s
1 issue
find-bugs: Found 1 issue (1 medium)
Medium
Test may fail due to race condition: no time for profiler to capture samples - `tests/profiler/test_continuous_profiler.py:269-274`
The test removes time.sleep(0.05) inside the span and replaces it with pass. The profiler thread samples at intervals (self.interval = 1.0 / frequency). Without any delay, the profiler thread may not execute its sampling loop before _scheduler.running = False is set, resulting in zero profile chunks being captured. The assertion assert len(items["profile_chunk"]) > 0 would then fail.
Duration: 55.6s · Tokens: 133.6k in / 2.2k out · Cost: $0.24
Annotations
Check warning on line 274 in tests/profiler/test_continuous_profiler.py
sentry-warden / warden: find-bugs
Test may fail due to race condition: no time for profiler to capture samples
The test removes `time.sleep(0.05)` inside the span and replaces it with `pass`. The profiler thread samples at intervals (`self.interval = 1.0 / frequency`). Without any delay, the profiler thread may not execute its sampling loop before `_scheduler.running = False` is set, resulting in zero profile chunks being captured. The assertion `assert len(items["profile_chunk"]) > 0` would then fail.
Loading