mn:run: stop adding -Dcom.sun.management.jmxremote to the application's command line #1735
All Vouch review confidence checks passed
Residual risk 0.07 = Change Risk (0.40) × (1 − Review Confidence (0.82)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 134 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.73 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.293
Real PR Conversation Timeline
4 items
 Quality Gate passed
Issues
 0 New issues
 0 Accepted issues
Measures
 0 Security Hotspots
 0.0% Coverage on New Code
 0.0% Duplication on New Code
<!-- sqra-placement-anchor -->
See analysis details on SonarQube Cloud
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Approved
Approved these changes.
graemerocher
alvarosanchez
Fixes #1732
What changed
RunMojo.buildRunArgumentsno longer adds-Dcom.sun.management.jmxremote. The first start and every restart both build their command line there, so neither starts the JMX management agent and its local RMI connector beforemainany more. The rest of the command line is unchanged,-XX:TieredStopAtLevel=1included.run.adocnow documents it in a new "Monitoring with JMX" section next to "Debugging":-
mvn mn:run -Dcom.sun.management.jmxremote(mn:runpasses Maven user properties on to the application);-
mvn mn:run -Dmn.jvmArgs=-Dcom.sun.management.jmxremote;-
<jvmArguments>-Dcom.sun.management.jmxremote</jvmArguments>in the plugin configuration;- for remote JMX,
com.sun.management.jmxremote.portplus the authentication and SSL properties. The base flag is not needed.The section also says that JConsole, VisualVM and JMC start the local agent on demand when they attach, that
jcmddoes not use the agent, and that a JVM run with-XX:+DisableAttachMechanismneeds the opt-in.How it was verified
All local runs used Homebrew OpenJDK 25.0.4.1 on macOS (Apple M4 Pro), with
nice -n 19.RunMojoTest, 3 new cases onbuildRunArguments. Each one asserts the whole command line afterjava:- by default,
-classpath <reactor outputs>:<dependencies> -XX:TieredStopAtLevel=1 <main class>, with no-Dcom.sun.management.jmxremote;- with
jvmArgumentsset to-Dcom.sun.management.jmxremote, the flag appears once, before-classpath;- with the user property
com.sun.management.jmxremote=true(what Maven gives a-Dwithout a value),-Dcom.sun.management.jmxremote=trueappears once.With the removed line put back, all 3 fail, because the command line has an extra
-Dcom.sun.management.jmxremotebefore the main class. The existing AOT case still passes.run, extended as AGENTS.md asks forRunMojochanges. It now runsmn:runthree times: by default, with-Dmn.jvmArgs=-Dcom.sun.management.jmxremote, and with-Dcom.sun.management.jmxremote. The app prints whether the property is set and whether the agent started. The agent check looks for the local connector'sRMI TCP Acceptthread.verify.groovyexpectsfalse, true, truefor both values.- Without the change, the scenario fails: the default run prints
truefor both values.-
jdk.management.agentis not a usable signal for this check. In a full JDK it is in the boot layer with or without the flag, becausejdk.jconsole, a default root module, requires it.mn:runscenarios also pass:run-aot,run-aot-jvmargs,multi-project,multi-project-multi-runnable,multi-project-multi-runnable-errorandtest-resources-run.run-native-agentwas skipped locally because its selector needs GraalVM; CI runs it../mvnw verify -Dinvoker.skip=truepasses: all module tests, Checkstyle and Spotless. This repository runs no japicmp.mvn siterenders the newrun.adocsection.Class loading through
mn:runitself (not a timing): I ranmn:runfrom this branch on therunscenario's app (a picocli command on Micronaut 5.0), with-Xlog:class+loadpassed throughmn.jvmArgs. The counts are deterministic, so one run of each variant:| | Default (this PR) | Opt-in (
-Dcom.sun.management.jmxremote, today's default) ||---|---|---|
| Classes loaded before
main| 404 | 1,919 || Classes loaded by exit | 3,715 | 4,415 |
| JMX and management classes | 0 | 189 |
| RMI classes | 0 | 51 |
Timing: this PR adds no new timing measurement. The figures in #1732 come from the startup study on one Apple M4 Pro (12 CPUs). It ran 3 sessions × 20 interleaved pairs per app and JDK, on the Gradle
runtask's launch line, which passes the same two JVM flags (-XX:TieredStopAtLevel=1 -Dcom.sun.management.jmxremote, plus Gradle's-Dfile.encodingand-Duser.*properties) and the same class-path shape asmn:run(classes, resources, dependency JARs), without a build tool in the loop. The machine was shared. In each session the bounded wait for load below 3 (12 CPUs / 4) expired after 300 s, and load1 averaged 4.5-5.3 (peak 6.7). The variants ran in a fresh random order in every iteration, so load drift hits both sides of each pair alike, and the paired shares hold: per-session savings ranged from 5.8% to 10.7%, and every session's 95% CI excludes zero. Over the 3 sessions, dropping the flag saved 6.5% to 9.1% of readiness (median of the paired differences, as a share of readiness with the flag). Read them as relative figures for that machine.mn:runitself was not timed.SemVer / API
mn:run, so it targets5.1.x(5.1.0) and not a 5.0.x patch.buildRunArgumentsstays private, and the new test reaches it by reflection, as the existingrunAotIfNeededtest does.type: improvement, like the issue.Release note
The release notes are the GitHub Releases, generated from PR titles and labels (
.github/release.yml;release-history.adocpoints there). There is no in-tree changelog, so the note is this PR's title under "Improvements", plus this text for the 5.1.0 notes:Left for follow-ups
runtask: micronaut-projects/micronaut-gradle-plugin#1388, in progress in micronaut-projects/micronaut-gradle-plugin#1391.exec:execarguments: micronaut-projects/micronaut-platform#2817.ServerUtilsin micronaut-test-resources: no issue yet. The gain there is small, because the server is long-lived.mn:run(#1731) should be re-measured on top of this change. Without the flag, the dump no longer needs--add-modules=jdk.management.agentunless the user opts back in.mn:devandmn:test(#1725, #1726) do not add the flag and should keep it that way.-XX:TieredStopAtLevel=1is unchanged. The flag's cost depends on the JIT mode, so re-measure if that line changes.🤖 Generated with Claude Code