Problem
The single SentryExecutorService thread starts working immediately during init: loadLazyFields (JsonSerializer map build), previous-session move/finalize (file IO), ANR ApplicationExitInfo parsing (binder + parse), cached-envelope sends, options-persistence writes (sentry/src/main/java/io/sentry/Sentry.java:548), system-events receiver registration. On 4-core devices this competes for CPU/IO with the app's first-frame work, even though almost none of it is needed in the first second.
Proposal
Investigate gating non-critical tasks (ANR exit-info processing, options persistence reset, previous-session finalize, device-info pre-cache) on first-frame / idle — e.g. via the existing AppStartMetrics activity lifecycle callbacks — instead of enqueueing them at init.
Same philosophy as SDK-1346 (delay Session Replay init), applied to the executor queue.
Constraints
- The startup-crash flush must stay immediate (it deliberately blocks init).
- Previous-session finalize and ANR processing exist to deliver crashes/ANRs early — quantify the delivery-latency tradeoff before moving them.
- Headless processes (services, workers) never render a first frame — need a fallback trigger (idle handler or timeout).
Problem
The single
SentryExecutorServicethread starts working immediately during init:loadLazyFields(JsonSerializer map build), previous-session move/finalize (file IO), ANRApplicationExitInfoparsing (binder + parse), cached-envelope sends, options-persistence writes (sentry/src/main/java/io/sentry/Sentry.java:548), system-events receiver registration. On 4-core devices this competes for CPU/IO with the app's first-frame work, even though almost none of it is needed in the first second.Proposal
Investigate gating non-critical tasks (ANR exit-info processing, options persistence reset, previous-session finalize, device-info pre-cache) on first-frame / idle — e.g. via the existing
AppStartMetricsactivity lifecycle callbacks — instead of enqueueing them at init.Same philosophy as SDK-1346 (delay Session Replay init), applied to the executor queue.
Constraints