Repository navigation
Conversation
A stop request only sets shouldStop, and the profiler stops when the current chunk ends. A start call before that was ignored because the profiler was still running, and shouldStop stayed set. So the profiler stopped at the end of the chunk, even in TRACE mode while sampled spans were active. The legacy profiler also never reset shouldStop, so after the first stop every later profile ended after one chunk. Reset shouldStop on every sampled start call in AndroidContinuousProfiler and PerfettoContinuousProfiler. A manual start while the profiler runs is now an expected call, so the Perfetto profiler logs it at DEBUG level like the legacy profiler.
This was referenced Oct 20, 2026
fix(profiling): Cancel a pending stop when startProfiler is called again
getsentry/sentry-cocoa#9401
Open
📲 Install BuildsAndroid
|
alwx
marked this pull request as ready for review
October 20, 2026 13:57
alwx
requested review from
0xadam-brown,
adinauer,
markushi,
romtsn and
runningcode
as code owners
October 20, 2026 13:57
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📜 Description
AndroidContinuousProfilerandPerfettoContinuousProfilernow resetshouldStopon every sampledstartProfilercall. A start call that comes before a requested stop takes effect now cancels the stop, in bothMANUALandTRACEmode. A manual start while the profiler runs is now an expected call, so the Perfetto profiler logs it at DEBUG level, like the legacy profiler.💡 Motivation and Context
stopProfileronly setsshouldStop, and the profiler stops when the current 60 second chunk ends. A start call before that was ignored because the profiler was still running, so the profile ended at the end of the chunk while sampled spans were still active. The legacy profiler also never resetshouldStop, so after the first stop every later profile ended after one chunk. React Native hit this in its UI profiling fix (getsentry/sentry-react-native#6916), where JS starts and stops the native profiler for back-to-back transactions.💚 How did you test it?
Wrote tests + verified myself.
📝 Checklist
sendDefaultPIIis enabled.