Skip to content

fix(devloop): start forked servers on the chosen JDK when JDK_HOME is set - #27683

Merged
mcollovati merged 1 commit into
mainfrom
fix/devloop-jdk-home
Dec 4, 2026
Merged

mcollovati merged 1 commit into
mainfrom
fix/devloop-jdk-home

Conversation

@mcollovati

Copy link
Copy Markdown
Contributor

Behavior deviation · flow-devloop-daemon · developers and CI agents that run Payara Server with JDK_HOME set to another JDK

When JDK_HOME points to a different JDK than the one the dev loop chose, vaadin-dev start on Payara Server starts the server on that other JDK. On the nightly CI agent that is Java 8, which stops at the first --add-opens flag, so the server never starts and every start times out. Setting PAYARA_JAVA_HOME is the workaround.

Risks:

  • ⚠️ Behavior change: every Maven-launched application now gets JDK_HOME set to the chosen JDK, like JAVA_HOME already is. A plugin that read an inherited JDK_HOME on purpose now gets the dev loop's JDK.
  • ✅ No public API, security, memory, serialization, threading, performance or migration impact.

Context. The daemon already sets JAVA_HOME and puts the chosen JDK first on PATH, so that a forked server runs on it. The Payara Server Maven plugin looks at payara.java.home, PAYARA_JAVA_HOME, JDK_HOME and only then JAVA_HOME, and the TeamCity agents set JDK_HOME to Java 8.

  • Set JDK_HOME to the chosen JDK in the environment MavenGoalRuntime gives the Maven process
  • Checked JDK_HOME in MavenGoalRuntimeTest
  • Documented the variable in the forked-server section of the daemon README

… set

Payara Server's Maven plugin reads JDK_HOME before JAVA_HOME, so an
inherited JDK_HOME started the server on another JDK. The daemon now
sets JDK_HOME to the same JDK as JAVA_HOME.
@mcollovati

mcollovati commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Type of change

  • Bugfix
How it was found

The nightly "Flow Dev Loop (all servers)" build ran the Payara Server fixture for hours with every vaadin-dev start timing out. Its app.log showed the plugin starting the server with /usr/lib/jvm/jdk1.8.0_201/bin/java, ending with:

Unrecognized option: --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED

Maven itself ran on JDK 21 (the daemon set JAVA_HOME), but the agent sets JDK_HOME=/usr/lib/jvm/jdk1.8.0_201, and PayaraServerLocalInstance.getJDKHome() falls back to JDK_HOME before JAVA_HOME (payara-server-maven-plugin 1.3.0, JDKVersion.getDefaultJDKHome()).

Test coverage
  • MavenGoalRuntimeTest: 27/27 pass, including the new JDK_HOME check.
  • End to end: the nightly TeamCity build "Flow Dev Loop (all servers)" is green on an agent with JDK_HOME set to Java 8, with this fix picked temporarily onto test: stop retrying a dev loop start that keeps timing out #27681. Without it, Payara Server never started there.

@github-actions github-actions Bot added the +0.0.1 label Dec 4, 2026
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Test Results

 1 662 files  ±0   1 753 suites  ±0   1h 43m 57s ⏱️ - 4m 5s
14 142 tests ±0  14 070 ✅ ±0  72 💤 ±0  0 ❌ ±0 
14 578 runs  ±0  14 506 ✅ ±0  72 💤 ±0  0 ❌ ±0 

Results for commit 5be8ba6. ± Comparison against base commit 5c4f2c7.

mcollovati added a commit that referenced this pull request Dec 4, 2026
… set

Temporary pick of #27683 for a nightly CI run. Remove before merging this PR.
@mcollovati
mcollovati marked this pull request as ready for review December 4, 2026 12:55

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ Nothing to flag — the changes look good.

@mcollovati
mcollovati added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit 3f58e05 Dec 4, 2026
76 checks passed
@mcollovati
mcollovati deleted the fix/devloop-jdk-home branch December 4, 2026 17:37
vaadin-bot added a commit that referenced this pull request Dec 4, 2026
… set (#27683) (CP: 25.4) (#27690)

This PR cherry-picks changes from the original PR #27683 to branch 25.4.

---

> **Behavior deviation** · flow-devloop-daemon · developers and CI
agents that run Payara Server with `JDK_HOME` set to another JDK
> 
> When `JDK_HOME` points to a different JDK than the one the dev loop
chose, `vaadin-dev start` on Payara Server starts the server on that
other JDK. On the nightly CI agent that is Java 8, which stops at the
first `--add-opens` flag, so the server never starts and every start
times out. Setting `PAYARA_JAVA_HOME` is the workaround.
> 
> **Risks:**
> - ⚠️ Behavior change: every Maven-launched application now gets
`JDK_HOME` set to the chosen JDK, like `JAVA_HOME` already is. A plugin
that read an inherited `JDK_HOME` on purpose now gets the dev loop's
JDK.
> - ✅ No public API, security, memory, serialization, threading,
performance or migration impact.
> 
> **Context.** The daemon already sets `JAVA_HOME` and puts the chosen
JDK first on `PATH`, so that a forked server runs on it. The Payara
Server Maven plugin looks at `payara.java.home`, `PAYARA_JAVA_HOME`,
`JDK_HOME` and only then `JAVA_HOME`, and the TeamCity agents set
`JDK_HOME` to Java 8.
> 
> - Set `JDK_HOME` to the chosen JDK in the environment
`MavenGoalRuntime` gives the Maven process
> - Checked `JDK_HOME` in `MavenGoalRuntimeTest`
> - Documented the variable in the forked-server section of the daemon
README
>

Co-authored-by: Marco Collovati <marco@vaadin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants