Skip to content

Commit 11331ea

Browse files
43jayclaude
andcommitted
fix(profiling): Move shouldStop reset inside !isRunning() guard
shouldStop = false was unconditionally set at the top of startProfiler, which could cancel a pending stop if startProfiler was called on an early-return path (e.g. MANUAL while already running). Move the reset to inside the !isRunning() block so it only triggers when the profiler is actually about to start. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 85e54fc commit 11331ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/PerfettoContinuousProfiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ public void startProfiler(
107107
final @NotNull ProfileLifecycle profileLifecycle,
108108
final @NotNull TracesSampler tracesSampler) {
109109
try (final @NotNull ISentryLifecycleToken ignored = lock.acquire()) {
110-
shouldStop = false;
111110
if (shouldSample) {
112111
isSampled = tracesSampler.sampleSessionProfile(SentryRandom.current().nextDouble());
113112
shouldSample = false;
@@ -132,6 +131,7 @@ public void startProfiler(
132131
}
133132
if (!isRunning()) {
134133
logger.log(SentryLevel.DEBUG, "Started Profiler.");
134+
shouldStop = false;
135135
startInternal();
136136
}
137137
}

0 commit comments

Comments
 (0)