Skip to content

test: Join thread in continuous profiler test#6125

Merged
alexander-alderman-webb merged 3 commits intomasterfrom
webb/flaky-continuous-profiler-test
Apr 22, 2026
Merged

test: Join thread in continuous profiler test#6125
alexander-alderman-webb merged 3 commits intomasterfrom
webb/flaky-continuous-profiler-test

Conversation

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Apr 22, 2026

Description

Flush the profiler's buffer after the first profile is collected, and suspend execution of main thread to wait for the profiler's buffer to flush before evaluating assertions.

According to the logs in the following failed run

https://github.com/getsentry/sentry-python/actions/runs/24769385099/job/72476526451

the test fails with the following stack trace:

FAILED tests/profiler/test_continuous_profiler.py::test_continuous_profiler_auto_start_and_manual_stop[non-experiment-start_profile_session/stop_profile_session (deprecated)-thread] - tests/profiler/test_continuous_profiler.py:270: in test_continuous_profiler_auto_start_and_manual_stop
    assert_single_transaction_with_profile_chunks(envelopes, thread)
tests/profiler/test_continuous_profiler.py:147: in assert_single_transaction_with_profile_chunks
    assert len(items["profile_chunk"]) > 0
E   assert 0 > 0
E    +  where 0 = len([])

The stack trace shows that profiles were not collected in the test transport by the time the assertion is executed.

The assertion runs before any manual calls to start and stop the profiler. The profiler is auto-activated and creates a profile for the transaction context manager.

Issues

Reminders

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 8.93s

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 14757 uncovered lines.


Generated by Codecov Action

Comment thread tests/profiler/test_continuous_profiler.py Outdated
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review April 22, 2026 11:49
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner April 22, 2026 11:49
@alexander-alderman-webb alexander-alderman-webb merged commit 4c0b283 into master Apr 22, 2026
157 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/flaky-continuous-profiler-test branch April 22, 2026 14:26
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.

2 participants