Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

### Fixes

- Keep the interrupt of the thread that calls `Sentry.init` when it is interrupted while the SDK waits for cached events to be sent after a startup crash ([#6568](https://github.com/getsentry/sentry-java/pull/6568))
- Capture scroll breadcrumbs for `LazyColumn`, `LazyRow`, lazy grids, and `Pager` on Jetpack Compose foundation 1.10+ ([#6548](https://github.com/getsentry/sentry-java/pull/6548))
- Prevent the main thread from potentially hanging during app start or when returning to the foreground if Android is slow to register the SDK's network or telephony listeners. `Sentry.init`, Session Replay, and capturing events no longer wait for that registration ([#6537](https://github.com/getsentry/sentry-java/pull/6537))
- Add opt-in support for matching GraphQL ignored error types against classification specifications via `sentry.graphql.enable-specification-error-type-filtering` ([#6092](https://github.com/getsentry/sentry-java/pull/6092))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ private void sendCachedEnvelopes(
options
.getLogger()
.log(SentryLevel.DEBUG, "Synchronous send timed out, continuing in the background.");
} catch (InterruptedException e) {
// We don't own the calling thread, so keep its interrupt for the code that does
Thread.currentThread().interrupt();
options
.getLogger()
.log(
SentryLevel.DEBUG, "Synchronous send interrupted, continuing in the background.");
}
}
options.getLogger().log(SentryLevel.DEBUG, "SendCachedEnvelopeIntegration installed.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.sentry.android.core

import com.google.common.truth.Truth.assertThat
import io.sentry.IConnectionStatusProvider
import io.sentry.IConnectionStatusProvider.ConnectionStatus
import io.sentry.ILogger
Expand Down Expand Up @@ -137,6 +138,27 @@ class SendCachedEnvelopeIntegrationTest {
verify(fixture.sender).send()
}

@Test
fun `when interrupted while awaiting the task, keeps the interrupt and continues in the background`() {
// the delay keeps the task running, so the wait for it sees the interrupt
val sut = fixture.getSut(hasStartupCrashMarker = true, delaySend = 500)

Thread.currentThread().interrupt()
try {
sut.register(fixture.scopes, fixture.options)

assertThat(Thread.currentThread().isInterrupted).isTrue()
} finally {
// don't leak the interrupt into other tests
Thread.interrupted()
}
verify(fixture.logger)
.log(eq(DEBUG), eq("Synchronous send interrupted, continuing in the background."))

await.untilFalse(fixture.flag)
verify(fixture.sender).send()
}

@Test
fun `registers for network connection changes`() {
val sut =
Expand Down
Loading