Skip to content

Fix WildFly scheduled test race - #12385

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
alexeyk/fix-wildfly-scheduled-test-race
Sep 4, 2026
Merged

Fix WildFly scheduled test race#12385
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
masterfrom
alexeyk/fix-wildfly-scheduled-test-race

Conversation

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor

What Does This Do

Corrects the WildFly scheduled-EJB smoke-test handshake. The /enableScheduling controller now waits while the scheduled request remains pending and returns after the EJB consumes the flag.

Motivation

The previous wait condition was inverted. When the scheduled EJB reset ENABLED before the asynchronous supplier read it, the supplier entered a loop that could not end and Spring eventually returned HTTP 503 instead of 200. The test passed when the supplier happened to run first because it observed true, skipped the inverted loop, and returned immediately.

Additional Notes

Failure evidence: affected executions spent about 30.5 seconds in scheduled ejb has right service name and then failed response.code() == 200 because the response code was 503. That duration is consistent with the Spring asynchronous request timeout.

The flag states are:

  • true: a scheduled invocation is pending.
  • false: the scheduled EJB has picked up the request with getAndSet(false).

Changing the loop from while (!ENABLED.get()) to while (ENABLED.get()) makes both thread orderings safe. If the supplier runs first, it waits for the EJB to clear the flag. If the EJB runs first, the supplier observes false and returns immediately. AtomicBoolean provides visibility between the two threads.

The EJB clears the flag before calling generateSomeTrace(), so HTTP 200 specifically confirms that the EJB picked up the request. The suite-level trace-count assertion independently verifies that the scheduled trace was emitted.

Validation:

  • ./gradlew :dd-smoke-tests:wildfly:test -PtestJvm=8 — 203 tests passed.
  • ./gradlew :dd-smoke-tests:wildfly:test -PtestJvm=11 — 203 tests passed.
  • ./gradlew :dd-smoke-tests:wildfly:test -PtestJvm=8 --rerun-tasks — 203 tests passed.

Relevant precedent: #8064 introduced this scheduled-EJB service-name coverage and its flag handshake.

Contributor Checklist

Jira ticket: N/A

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD added tag: ai generated Largely based on code generated by an AI or LLM comp: testing Testing type: bug fix Bug fix tag: no release notes Changes to exclude from release notes tag: flaky test Flaky tests labels Sep 2, 2026
@AlexeyKuznetsov-DD
AlexeyKuznetsov-DD marked this pull request as ready for review September 2, 2026 17:16
@AlexeyKuznetsov-DD
AlexeyKuznetsov-DD requested a review from a team as a code owner September 2, 2026 17:16
@AlexeyKuznetsov-DD
AlexeyKuznetsov-DD requested review from ygree and removed request for a team September 2, 2026 17:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T17:18:45.400357Z 076e262 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 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: PASS

More details

The new loop waits while the request is pending. It stops after the EJB clears the flag.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 076e262 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@dd-octo-sts

dd-octo-sts Bot commented Sep 2, 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 13.89 s 13.92 s [-1.0%; +0.5%] (no difference)
startup:insecure-bank:tracing:Agent 12.99 s 12.97 s [-0.8%; +1.1%] (no difference)
startup:petclinic:appsec:Agent 16.95 s 16.92 s [-0.6%; +1.0%] (no difference)
startup:petclinic:iast:Agent 16.92 s 16.98 s [-1.2%; +0.5%] (no difference)
startup:petclinic:profiling:Agent 16.82 s 16.89 s [-1.8%; +0.9%] (no difference)
startup:petclinic:sca:Agent 16.95 s 16.73 s [+0.1%; +2.5%] (maybe worse)
startup:petclinic:tracing:Agent 16.07 s 16.16 s [-1.8%; +0.7%] (no difference)

Commit: 1f786fa1 · 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.

@ygree ygree 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.

Good catch! Perhaps ENABLED is to a clear name for this flag.

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Sep 4, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-09-04 00:01:51 UTC ℹ️ Start processing command /merge


2026-09-04 00:01:57 UTC ℹ️ MergeQueue: pull request added to the queue

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


2026-09-04 00:52:07 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit c6a78ec into master Sep 4, 2026
808 of 810 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the alexeyk/fix-wildfly-scheduled-test-race branch September 4, 2026 00:52
@github-actions github-actions Bot added this to the 1.66.0 milestone Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: testing Testing tag: ai generated Largely based on code generated by an AI or LLM tag: flaky test Flaky tests tag: no release notes Changes to exclude from release notes type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants