Repository navigation
fix(spring): Prevent Reactor pool scope chain leaks - #6283
Merged
Merged
Conversation
Skip scope propagation for Reactor pool maintenance tasks that reschedule themselves indefinitely. This prevents each run from retaining the previous run through the parent scope chain. Add a Reactor Netty connection pool regression test that verifies background eviction keeps scope depth bounded. Fixes GH-6248 Refs JAVA-773 Co-Authored-By: Claude <noreply@anthropic.com>
Remove the Reactor Netty integration test and its test-only Truth dependency. Co-Authored-By: Claude <noreply@anthropic.com>
📲 Install BuildsAndroid
|
Exclude HTTP/2 eviction lambdas and narrow the existing Reactor Netty matches to maintenance lambdas. Keep standalone Reactor Pool acquisition delivery wrapped so request scopes continue to propagate. Add coverage for supported lambda class name shapes and request-carrying negative cases across all Spring integrations. Refs GH-6248 Refs JAVA-773 Co-Authored-By: Claude <noreply@anthropic.com>
adinauer
marked this pull request as ready for review
October 22, 2026 14:11
adinauer
requested review from
0xadam-brown,
markushi,
romtsn and
runningcode
as code owners
October 22, 2026 14:11
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Exclude Reactor Netty pool maintenance runnables from
SentryScheduleHookscope propagation. The exclusions cover HTTP/1.1 and HTTP/2 background eviction as well as inactive-pool disposal across all Spring integrations.💡 Motivation and Context
These maintenance tasks schedule their next run while the current wrapped run is still active. Each scheduling pass therefore forks from the previous pass and retains it through
parentScopes, creating an unbounded scope chain. In the production report, 63 connection pools retained approximately 4 GB after 12.8 days.Infrastructure maintenance tasks do not need request scope propagation, so narrowly excluding their runtime class prefixes prevents the chain without affecting normal Reactor scheduler boundaries such as
publishOnandsubscribeOn. The standalone Reactor PoolSimpleDequePoolis intentionally not excluded because it uses the same lambda class prefix for request-carrying acquisition delivery.Partially addresses #6248
Refs JAVA-773
💚 How did you test it?
Ran the issue's real Reactor Netty
ConnectionProvider.evictInBackgroundreproduction locally for 100 eviction schedules. Scope depth reached 103 without the exclusions and remained below 10 with them. A real H2C client reproduction reached depth 100 without the HTTP/2 exclusion and remained at depth 2 with it.Added exclusion-matching tests for the Spring Boot 2, 3, and 4 integrations, including numbered and unnumbered JVM lambda class names and request-carrying negative cases.
./gradlew :sentry-spring:test :sentry-spring-jakarta:test :sentry-spring-7:test --tests='*SentryScheduleHookTest' --info./gradlew spotlessApply apiDump📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Investigate a generic task-scope retention fix for the next major version.