Skip to content

Write JUL config file before the log-injection smoke test app starts - #13476

Open
bm1549 wants to merge 2 commits into
masterfrom
brian.marks/loginjection-jul-config-before-start
Open

bm1549 wants to merge 2 commits into
masterfrom
brian.marks/loginjection-jul-config-before-start

Conversation

@bm1549

@bm1549 bm1549 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Writes the java.util.logging.config.file properties file for the JUL-backed log-injection smoke tests before the test app starts. A new JULConfiguredSmokeTest base class owns the temp file: it writes it from additionalArguments(), which runs while the process command is built, and deletes it in cleanupSpec(). Before, JULBackend and JULInterfaceSlf4jToLogbackBackend each wrote it in setupSpec(). They now extend the base and only supply their handler settings through writeJulProperties(PrintWriter).

Motivation

Since #12609, ProcessManager.setupSpec starts the child process and waits on scopeDiagnostics.awaitReady(p) before the subclass setupSpec runs. So the child's LogManager could read the temp config file while it was still empty. It then installed no FileHandler, the raw log stayed empty, and "check raw file injection" failed with logLines.size() == 7 against an empty list.

On master over the last 90 days, 99 of 102 failures of this test have that signature, all on HotSpot 17/21/25/tip:

  • FloggerInterfaceJULBackend: 92
  • JULInterfaceSlf4jToLogbackBackend: 5
  • JBossInterfaceJULBackend: 2

Weekly counts went from 13 to 36 to 46.

Additional Notes

  • outputLogFile is created earlier in createProcessBuilder, so the FileHandler.pattern written into the config still points at the right file.
  • No subclass of JULConfiguredSmokeTest overrides additionalArguments(), so they all get the new ordering.
  • Local verification (JDK 8): all 9 JUL suites pass (FloggerInterfaceJULBackend, JBossInterfaceJULBackend, JCLInterfaceJULBackend, JULInterfaceJULBackend, Slf4jInterfaceJULBackend, and JULInterfaceSlf4jToLogbackBackend with its NoTags, 128bTid and Latest variants). I reproduced the race on the old code by delaying the config write, and it failed with the same assertion as CI. With the same delay, the fix passes.

Contributor Checklist

Jira ticket: N/A

JULBackend and JULInterfaceSlf4jToLogbackBackend wrote their
java.util.logging.config.file contents in setupSpec. Spock runs the
superclass setupSpec first, and ProcessManager.setupSpec starts the
child process there and waits for scope diagnostics to be ready. The
child's LogManager could read the still-empty temp file, install no
handler, and drop every log line, which failed "check raw file
injection" with an empty raw log.

Write the properties file from additionalArguments(), which runs while
the process command is built and before the process starts.
@bm1549 bm1549 added type: bug fix Bug fix comp: testing Testing tag: no release notes Changes to exclude from release notes tag: flaky test Flaky tests tag: ai generated Largely based on code generated by an AI or LLM labels Nov 16, 2026
@bm1549
bm1549 marked this pull request as ready for review November 16, 2026 19:39
@bm1549
bm1549 requested review from a team as code owners November 16, 2026 19:39
@bm1549
bm1549 requested review from AlexeyKuznetsov-DD and khanayan123 and removed request for a team November 16, 2026 19:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T19:41:19.409428Z b6c2a63 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-16T19:41:30.093987Z b6c2a63 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 datadog-datadog-prod-us1 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.

Bits Code Review: PASS

More details

The JUL configuration writes complete after log-file initialization and before child-process startup, removing the empty-config race while preserving logging settings and cleanup behavior.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit b6c2a63

@dd-octo-sts

dd-octo-sts Bot commented Nov 16, 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.91 s 14.75 s [+0.1%; +2.1%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.65 s 13.69 s [-1.3%; +0.7%] (no difference)
startup:petclinic:appsec:Agent 17.80 s 17.66 s [-0.2%; +1.8%] (no difference)
startup:petclinic:iast:Agent 17.49 s 17.70 s [-2.0%; -0.4%] (maybe better)
startup:petclinic:profiling:Agent 17.39 s 17.56 s [-2.0%; +0.1%] (no difference)
startup:petclinic:sca:Agent 17.74 s 17.67 s [-0.4%; +1.2%] (no difference)
startup:petclinic:tracing:Agent 16.78 s 16.79 s [-1.0%; +0.9%] (no difference)

Commit: 19bf9a75 · 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.

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD 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.

Optional cleanup, not a blocker; the current fix looks correct.

Could we extract a common JULConfiguredSmokeTest extends LogInjectionSmokeTest base class for JULBackend and JULInterfaceSlf4jToLogbackBackend. It could own the temporary config file, writing it before process startup, and cleanup, leaving only the handler-specific settings in each subclass.?

Add JULConfiguredSmokeTest, which owns the temporary
java.util.logging.config.file, writes it from additionalArguments()
before the process starts, and deletes it in cleanupSpec. JULBackend
and JULInterfaceSlf4jToLogbackBackend now only write their
handler-specific properties.
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 60.32% (-0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 19bf9a7 | Docs | Give us feedback!

@bm1549

bm1549 commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Optional cleanup, not a blocker; the current fix looks correct.

Could we extract a common JULConfiguredSmokeTest extends LogInjectionSmokeTest base class for JULBackend and JULInterfaceSlf4jToLogbackBackend. It could own the temporary config file, writing it before process startup, and cleanup, leaving only the handler-specific settings in each subclass.?

@AlexeyKuznetsov-DD I made the suggested updates and have added to the MQ. If you have any feedback on how it was done, feel free to remove it from the MQ or post a follow-up here and I'm happy to apply it

@bm1549
bm1549 enabled auto-merge November 16, 2026 21:32
@bm1549
bm1549 added this pull request to the merge queue Nov 16, 2026
@dd-octo-sts

dd-octo-sts Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-16 22:40:41 UTC ℹ️ Start processing command /merge
Use /merge -c to cancel this operation!


2026-11-16 22:40:45 UTC ℹ️ MergeQueue: pull request added to the queue

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

Use /merge -c to cancel this operation!


⏳ Building merge commit 9b69a4e20d in pipeline 8918205831335818202...

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 16, 2026

This branch has not been deployed

No deployments
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