Repository navigation
Prevent Vert.x 4 session reaper from retaining request contexts #12667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gh-worker-dd-mergequeue-cf854d
merged 7 commits into
master
from
fix/vertx4-session-reaper-context
Sep 28, 2026
+64
−3
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6b7228b
fix: prevent Vert.x 4 session reaper from retaining requests
bric3 a1a51aa
chore: allow Vert.x timer guard in agent jar budget
bric3 e03c2a0
fix: limit Vert.x 4 session timer guard to 4.x
bric3 0d90db2
fix: keep Vert.x timer guard active without tracing
bric3 187c45c
chore: restore agent jar size budget
bric3 7446e00
refactor: share Vert.x session timer guard across 4 and 5
bric3 cc4edf2
fix: scope Vert.x session timer guard to Vert.x
bric3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...web/vertx-web-4.0/src/latestDepTest/java/server/LocalSessionStoreInstrumentationTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package server; | ||
|
|
||
| import static datadog.trace.agent.test.assertions.SpanMatcher.span; | ||
| import static datadog.trace.agent.test.assertions.TraceMatcher.trace; | ||
| import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan; | ||
| import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan; | ||
| import static java.util.concurrent.TimeUnit.SECONDS; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| import datadog.context.ContextScope; | ||
| import datadog.trace.agent.test.AbstractInstrumentationTest; | ||
| import datadog.trace.bootstrap.instrumentation.api.AgentSpan; | ||
| import io.vertx.core.Vertx; | ||
| import io.vertx.ext.web.sstore.LocalSessionStore; | ||
| import io.vertx.ext.web.sstore.impl.LocalSessionStoreImpl; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class LocalSessionStoreInstrumentationTest extends AbstractInstrumentationTest { | ||
| @Test | ||
| void initializingSessionStoreDoesNotRetainRequest() throws Exception { | ||
| Vertx vertx = Vertx.vertx(); | ||
| try { | ||
| AgentSpan parent = startSpan("test", "parent"); | ||
| LocalSessionStore store; | ||
| try (ContextScope ignored = activateSpan(parent)) { | ||
| store = LocalSessionStore.create(vertx, "initializing", 60_000); | ||
| } finally { | ||
| parent.finish(); | ||
| } | ||
| try { | ||
| assertTrue( | ||
| writer.waitForTracesMax(1, 3), "Session-store timers retained the request trace"); | ||
| assertTraces(trace(span().root().operationName("parent"))); | ||
| } finally { | ||
| store.close(); | ||
| } | ||
| } finally { | ||
| vertx.close().toCompletionStage().toCompletableFuture().get(10, SECONDS); | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| void rearmingSessionReaperDoesNotRetainRequest() throws Exception { | ||
| Vertx vertx = Vertx.vertx(); | ||
| LocalSessionStore store = LocalSessionStore.create(vertx, "rearming", 60_000); | ||
| try { | ||
| AgentSpan parent = startSpan("test", "parent"); | ||
| try (ContextScope ignored = activateSpan(parent)) { | ||
| ((LocalSessionStoreImpl) store).handle(0L); | ||
| } finally { | ||
| parent.finish(); | ||
| } | ||
| assertTrue(writer.waitForTracesMax(1, 3), "Session reaper retained the request trace"); | ||
| assertTraces(trace(span().root().operationName("parent"))); | ||
| } finally { | ||
| store.close(); | ||
| vertx.close().toCompletionStage().toCompletableFuture().get(10, SECONDS); | ||
| } | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.