Skip to content

Move akka context swap test to forked#11953

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
andrea.marziali/akka-flakt
Jul 15, 2026
Merged

Move akka context swap test to forked#11953
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
andrea.marziali/akka-flakt

Conversation

@amarziali

Copy link
Copy Markdown
Contributor

What Does This Do

This PR fixes the flakiness of akka/pekko context swap. tests. The main issue:

The akka/pekko mailbox was not shutting down properly. It was instantiated with one context mode and then when the configuration switched from one test to another there was:

11:43:21.891 [akka-actors-test-akka.actor.default-dispatcher-4] DEBUG datadog.trace.bootstrap.ExceptionLogger - Failed to handle exception in instrumentation for akka.dispatch.Mailbox - datadog.trace.instrumentation.akka.concurrent.AkkaMailboxInstrumentation$SuppressMailboxRunAdvice
java.lang.IllegalStateException: rollbackActiveToCheckpoint must not be called when context swap based logic is enabled
	at datadog.trace.core.CoreTracer.rollbackActiveToCheckpoint(CoreTracer.java:1225)
	at datadog.trace.core.CoreTracer$SpockMock$590092662.rollbackActiveToCheckpoint$accessor$y6uFR7JF(Unknown Source)
	at datadog.trace.core.CoreTracer$SpockMock$590092662$auxiliary$snbDkg3H.call(Unknown Source)
	at org.spockframework.mock.runtime.ByteBuddyMethodInvoker.respond(ByteBuddyMethodInvoker.java:22)
	at org.spockframework.mock.IResponseGenerator.lambda$getResponseSupplier$0(IResponseGenerator.java:67)
	at org.spockframework.mock.runtime.MockInvocation.callRealMethod(MockInvocation.java:61)
	at org.spockframework.mock.runtime.MockController.handle(MockController.java:60)
	at org.spockframework.mock.runtime.JavaMockInterceptor.intercept(JavaMockInterceptor.java:83)
	at org.spockframework.mock.runtime.ByteBuddyInterceptorAdapter.interceptNonAbstract(ByteBuddyInterceptorAdapter.java:35)
	at datadog.trace.core.CoreTracer$SpockMock$590092662.rollbackActiveToCheckpoint(Unknown Source)
	at datadog.trace.bootstrap.instrumentation.api.AgentTracer.rollbackActiveToCheckpoint(AgentTracer.java:128)
	at akka.dispatch.Mailbox.run(Mailbox.scala:228)
	at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
	at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
	at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
	at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
	at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

The second run passed because was on a fresh JVM.

This PR ensures that the actor system cleans nicely on test completion. Also moves those tests to forked for extra safety

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@amarziali
amarziali requested a review from a team as a code owner July 15, 2026 07:47
@amarziali
amarziali removed the request for review from a team July 15, 2026 07:47
@amarziali amarziali added the type: bug fix Bug fix label Jul 15, 2026
@amarziali
amarziali requested a review from ygree July 15, 2026 07:47
@amarziali
amarziali requested a review from mcculls July 15, 2026 07:47

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: FAIL

The PR adds @AutoCleanup to ensure actor system cleanup and moves flaky context-swap tests to a forked JVM, but introduces a critical bug in the Akka 2.3 termination logic: it unconditionally calls both shutdown() and awaitTermination(), but awaitTermination() does not exist in Akka 2.3.16, causing the tests to crash with NoSuchMethodException during cleanup.

View proposed fix
📊 Validated against 3 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 3160ba3 · What is Autotest? · Any feedback? Reach out in #autotest

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3160ba388f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread dd-java-agent/instrumentation/akka/akka-actor-2.5/build.gradle
@datadog-official

datadog-official Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 69.73% (+12.53%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9339edd | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.00 s 13.96 s [-0.6%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 12.96 s 12.98 s [-1.0%; +0.7%] (no difference)
startup:petclinic:appsec:Agent 16.96 s 16.85 s [-0.2%; +1.6%] (no difference)
startup:petclinic:iast:Agent 16.91 s 16.99 s [-1.3%; +0.3%] (no difference)
startup:petclinic:profiling:Agent 16.80 s 16.81 s [-1.2%; +1.1%] (no difference)
startup:petclinic:sca:Agent 16.54 s 16.85 s [-6.3%; +2.6%] (no difference)
startup:petclinic:tracing:Agent 16.15 s 16.44 s [-2.6%; -0.9%] (maybe better)

Commit: 9339edd4 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@amarziali
amarziali enabled auto-merge July 15, 2026 08:22
@amarziali
amarziali added this pull request to the merge queue Jul 15, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 15, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-15 08:46:09 UTC ℹ️ Start processing command /merge


2026-07-15 08:46:14 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-07-15 09:44:35 UTC ℹ️ MergeQueue: This merge request was merged

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 15, 2026
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 4242339 into master Jul 15, 2026
586 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the andrea.marziali/akka-flakt branch July 15, 2026 09:44
@github-actions github-actions Bot added this to the 1.65.0 milestone Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants