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 @@ -4,6 +4,7 @@

### Fixes

- Prevent Reactor pool maintenance tasks from retaining unbounded Sentry scope chains ([#6283](https://github.com/getsentry/sentry-java/pull/6283))
- Measure Session Replay's 1h recording cap and its touch-move debounce on a monotonic clock, so a device time change no longer stops a healthy recording early, keeps a finished one alive, or suppresses gesture events ([#6090](https://github.com/getsentry/sentry-java/pull/6090))

## 8.61.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,31 @@ public final class SentryScheduleHook implements Function<Runnable, Runnable> {
* scope parent chain buildup.
*
* @see <a href="https://github.com/getsentry/sentry-java/issues/5051">GitHub Issue #5051</a>
* @see <a href="https://github.com/getsentry/sentry-java/issues/6248">GitHub Issue #6248</a>
*/
private static final String[] EXCLUDED_RUNNABLE_PREFIXES = {
"reactor.kafka.receiver.internals.ConsumerEventLoop"
"reactor.kafka.receiver.internals.ConsumerEventLoop",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool$$Lambda",
"reactor.netty.http.client.Http2Pool$$Lambda",
"reactor.netty.resources.PooledConnectionProvider$$Lambda"
};

@Override
public Runnable apply(final @NotNull Runnable runnable) {
final String runnableClassName = runnable.getClass().getName();
// The standalone reactor.pool.SimpleDequePool is intentionally not excluded because it also
// schedules acquisition-delivery tasks that require scope propagation.
static boolean isExcluded(final @NotNull String runnableClassName) {
for (final String excludedPrefix : EXCLUDED_RUNNABLE_PREFIXES) {
if (runnableClassName.startsWith(excludedPrefix)) {
return runnable;
return true;
}
}
return false;
}

@Override
public Runnable apply(final @NotNull Runnable runnable) {
if (isExcluded(runnable.getClass().getName())) {
return runnable;
}

final IScopes newScopes = Sentry.getCurrentScopes().forkedCurrentScope("spring.scheduleHook");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotEquals
import kotlin.test.assertTrue

class SentryScheduleHookTest {
private val dsn = "http://key@localhost/proj"
Expand Down Expand Up @@ -55,4 +57,37 @@ class SentryScheduleHookTest {
}
.get()
}

@Test
fun `known maintenance runnable class names are excluded`() {
val classNames =
listOf(
"reactor.kafka.receiver.internals.ConsumerEventLoop\$PollEvent",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$\$Lambda\$42/0x00000001",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$\$Lambda/0x00000001",
"reactor.netty.http.client.Http2Pool\$\$Lambda\$42/0x00000001",
"reactor.netty.http.client.Http2Pool\$\$Lambda/0x00000001",
"reactor.netty.resources.PooledConnectionProvider\$\$Lambda\$42/0x00000001",
"reactor.netty.resources.PooledConnectionProvider\$\$Lambda/0x00000001",
)

classNames.forEach { className ->
assertTrue(SentryScheduleHook.isExcluded(className), className)
}
}

@Test
fun `request carrying runnable class names are not excluded`() {
val classNames =
listOf(
"reactor.netty.http.client.Http2Pool\$Borrower",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$QueueBorrowerMono",
"reactor.pool.SimpleDequePool\$\$Lambda\$42/0x00000001",
"com.example.RequestTask",
)

classNames.forEach { className ->
assertFalse(SentryScheduleHook.isExcluded(className), className)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,31 @@ public final class SentryScheduleHook implements Function<Runnable, Runnable> {
* scope parent chain buildup.
*
* @see <a href="https://github.com/getsentry/sentry-java/issues/5051">GitHub Issue #5051</a>
* @see <a href="https://github.com/getsentry/sentry-java/issues/6248">GitHub Issue #6248</a>
*/
private static final String[] EXCLUDED_RUNNABLE_PREFIXES = {
"reactor.kafka.receiver.internals.ConsumerEventLoop"
"reactor.kafka.receiver.internals.ConsumerEventLoop",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool$$Lambda",
"reactor.netty.http.client.Http2Pool$$Lambda",
"reactor.netty.resources.PooledConnectionProvider$$Lambda"
};

@Override
public Runnable apply(final @NotNull Runnable runnable) {
final String runnableClassName = runnable.getClass().getName();
// The standalone reactor.pool.SimpleDequePool is intentionally not excluded because it also
// schedules acquisition-delivery tasks that require scope propagation.
static boolean isExcluded(final @NotNull String runnableClassName) {
for (final String excludedPrefix : EXCLUDED_RUNNABLE_PREFIXES) {
if (runnableClassName.startsWith(excludedPrefix)) {
return runnable;
return true;
}
}
return false;
}

@Override
public Runnable apply(final @NotNull Runnable runnable) {
if (isExcluded(runnable.getClass().getName())) {
return runnable;
}

final IScopes newScopes = Sentry.getCurrentScopes().forkedCurrentScope("spring.scheduleHook");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotEquals
import kotlin.test.assertTrue

class SentryScheduleHookTest {
private val dsn = "http://key@localhost/proj"
Expand Down Expand Up @@ -55,4 +57,37 @@ class SentryScheduleHookTest {
}
.get()
}

@Test
fun `known maintenance runnable class names are excluded`() {
val classNames =
listOf(
"reactor.kafka.receiver.internals.ConsumerEventLoop\$PollEvent",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$\$Lambda\$42/0x00000001",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$\$Lambda/0x00000001",
"reactor.netty.http.client.Http2Pool\$\$Lambda\$42/0x00000001",
"reactor.netty.http.client.Http2Pool\$\$Lambda/0x00000001",
"reactor.netty.resources.PooledConnectionProvider\$\$Lambda\$42/0x00000001",
"reactor.netty.resources.PooledConnectionProvider\$\$Lambda/0x00000001",
)

classNames.forEach { className ->
assertTrue(SentryScheduleHook.isExcluded(className), className)
}
}

@Test
fun `request carrying runnable class names are not excluded`() {
val classNames =
listOf(
"reactor.netty.http.client.Http2Pool\$Borrower",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$QueueBorrowerMono",
"reactor.pool.SimpleDequePool\$\$Lambda\$42/0x00000001",
"com.example.RequestTask",
)

classNames.forEach { className ->
assertFalse(SentryScheduleHook.isExcluded(className), className)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,31 @@ public final class SentryScheduleHook implements Function<Runnable, Runnable> {
* scope parent chain buildup.
*
* @see <a href="https://github.com/getsentry/sentry-java/issues/5051">GitHub Issue #5051</a>
* @see <a href="https://github.com/getsentry/sentry-java/issues/6248">GitHub Issue #6248</a>
*/
private static final String[] EXCLUDED_RUNNABLE_PREFIXES = {
"reactor.kafka.receiver.internals.ConsumerEventLoop"
"reactor.kafka.receiver.internals.ConsumerEventLoop",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool$$Lambda",
"reactor.netty.http.client.Http2Pool$$Lambda",
"reactor.netty.resources.PooledConnectionProvider$$Lambda"
};

@Override
public Runnable apply(final @NotNull Runnable runnable) {
final String runnableClassName = runnable.getClass().getName();
// The standalone reactor.pool.SimpleDequePool is intentionally not excluded because it also
// schedules acquisition-delivery tasks that require scope propagation.
static boolean isExcluded(final @NotNull String runnableClassName) {
for (final String excludedPrefix : EXCLUDED_RUNNABLE_PREFIXES) {
if (runnableClassName.startsWith(excludedPrefix)) {
return runnable;
return true;
}
}
return false;
}

@Override
public Runnable apply(final @NotNull Runnable runnable) {
if (isExcluded(runnable.getClass().getName())) {
return runnable;
}

final IScopes newScopes = Sentry.getCurrentScopes().forkedCurrentScope("spring.scheduleHook");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotEquals
import kotlin.test.assertTrue

class SentryScheduleHookTest {
private val dsn = "http://key@localhost/proj"
Expand Down Expand Up @@ -55,4 +57,37 @@ class SentryScheduleHookTest {
}
.get()
}

@Test
fun `known maintenance runnable class names are excluded`() {
val classNames =
listOf(
"reactor.kafka.receiver.internals.ConsumerEventLoop\$PollEvent",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$\$Lambda\$42/0x00000001",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$\$Lambda/0x00000001",
"reactor.netty.http.client.Http2Pool\$\$Lambda\$42/0x00000001",
"reactor.netty.http.client.Http2Pool\$\$Lambda/0x00000001",
"reactor.netty.resources.PooledConnectionProvider\$\$Lambda\$42/0x00000001",
"reactor.netty.resources.PooledConnectionProvider\$\$Lambda/0x00000001",
)

classNames.forEach { className ->
assertTrue(SentryScheduleHook.isExcluded(className), className)
}
}

@Test
fun `request carrying runnable class names are not excluded`() {
val classNames =
listOf(
"reactor.netty.http.client.Http2Pool\$Borrower",
"reactor.netty.internal.shaded.reactor.pool.SimpleDequePool\$QueueBorrowerMono",
"reactor.pool.SimpleDequePool\$\$Lambda\$42/0x00000001",
"com.example.RequestTask",
)

classNames.forEach { className ->
assertFalse(SentryScheduleHook.isExcluded(className), className)
}
}
}