diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ced1fee97..70c9f04dee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Performance +- Avoid waiting up to `shutdownTimeoutMillis` when closing the SDK with a pending transaction timeout or session-end task ([#5851](https://github.com/getsentry/sentry-java/pull/5851)) - Use `RGB_565` instead of `ARGB_8888` for screenshot and replay capture bitmaps, halving per-frame memory usage ([#5821](https://github.com/getsentry/sentry-java/pull/5821)) - Remove an unused lock from `SentryPerformanceProvider`, which was allocated on every cold start in `ContentProvider.onCreate` without ever being acquired ([#5871](https://github.com/getsentry/sentry-java/pull/5871)) - Parse the app start profiling config with only the deserializer it needs instead of building a full `JsonSerializer` and `SentryOptions`, cutting 188 of 221 allocations on the main thread before `Application.onCreate` ([#5867](https://github.com/getsentry/sentry-java/pull/5867)) diff --git a/sentry/src/main/java/io/sentry/SentryExecutorService.java b/sentry/src/main/java/io/sentry/SentryExecutorService.java index e20c083563..e50cb032d4 100644 --- a/sentry/src/main/java/io/sentry/SentryExecutorService.java +++ b/sentry/src/main/java/io/sentry/SentryExecutorService.java @@ -55,6 +55,10 @@ public SentryExecutorService(final @Nullable SentryOptions options) { executorService.setRemoveOnCancelPolicy(removeOnCancelPolicy); executorService.setKeepAliveTime(keepAliveTime, keepAliveTimeUnit); executorService.allowCoreThreadTimeOut(true); + // by default shutdown() keeps queued delayed tasks, so awaitTermination blocks for the full + // shutdown timeout whenever a long timeout is still pending. Those tasks are discarded by the + // subsequent shutdownNow() anyway, so dropping them upfront only saves the wait. + executorService.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); } public SentryExecutorService() {