kressi opened a new issue, #12912:
URL: https://github.com/apache/maven/issues/12912
### Affected version
4.0.0-rc-6
### Bug description
## Summary
`mvn --version` hangs indefinitely with Maven `4.0.0-rc-6` under JDK 25 in a
Linux container environment.
The same command works with Maven `4.0.0-rc-5`under the same conditions.
This appears to be a regression in `rc-6`.
## Environment
- OS: Linux (container)
- Container image: `openjdk-25-jdk-bullseye`
- Java: OpenJDK 25 (`25+35-3488`)
- Maven versions compared:
- `4.0.0-rc-5` (works)
- `4.0.0-rc-6` (hangs)
## Regression statement
Under the sam eruntime and command line:
- `apache-maven-4.0.0-rc-5/bin/mvn --batch-mode --errors --show-warnings
--version` exits successfully
- `apache-maven-4.0.0-rc-6/bin/mvn --batch-mode --errors --show-warnings
--version` hangs and must be killed
## Reproduction (self-contained, JDK-only)
This script below avoids external package installs and uses only JDK tools
available in the image.
```bash
docker run --rm -it openjdk:25-jdk-bullseye bash -lc '
docker run --rm -it openjdk:25-ea-jdk-bullseye bash -lc '
set -euo pipefail
mkdir -p /tmp/mvncmp
cd /tmp/mvncmp
cat <<"EOF" > Downloader.java
import java.io.InputStream;
import java.net.URI;
import java.nio.file.*;
public class Downloader {
public static void main(String[] args) throws Exception {
try (InputStream in = URI.create(args[0]).toURL().openStream()) {
Files.copy(in, Paths.get(args[1]),
StandardCopyOption.REPLACE_EXISTING);
}
}
}
EOF
for v in 4.0.0-rc-5 4.0.0-rc-6; do
url="https://archive.apache.org/dist/maven/maven-4/${v}/binaries/apache-maven-${v}-bin.zip"
zip="apache-maven-${v}-bin.zip"
dir="apache-maven-${v}"
echo "Downloading ${url}"
/usr/local/openjdk-25/bin/java Downloader.java "${url}" "${zip}"
mkdir -p "${dir}"
(cd "${dir}" && /usr/local/openjdk-25/bin/jar xf "../${zip}")
mv "${dir}/apache-maven-${v}"/* "${dir}"
rmdir "${dir}/apache-maven-${v}"
chmod +x "${dir}/bin/mvn"
echo "== ${v} =="
timeout -k 5s 40s "${dir}/bin/mvn" --batch-mode --errors --show-version
--version
echo "rc=$?"
done
'
```
## Expected result
Both versions print Maven version and exit with code `0`.
## Actual result
- `rc-5`: exits with `0`
- `rc-6`: hangs; `timeout` kills process (`rc=124` from timeout wrapper,
process termination observed)
## Thread dump evidence from rc-6
While hung, `jcmd <pid> Thread.print -l` shows:
- `main` thread waiting in `CompleteableFuture.get()` from
org.apache.maven.jline.FastTerminal.getTerminal`
- a separate `fast-terminal-thread` also waiting in the same path
- stack includes Jline FFM terminal provider intitialization
(`org.jline.terminal.impl.ffm.CLibrary`)
Relevant frames:
```text
"main" ... WAITING (parking)
at java.util.concurrent.CompletableFuture.get
at org.apache.jline.FastTerminal.getTerminal(FastTerminall.java:68)
at org.apache.jline.FastTerminal.getType(FastTerminal.java:201)
at org.apache.slf4j.MavenSimpleLogger.configure(...)
at org.apache.cling.invoker.LookupInvoker.activeLogging(...)
"fast-terminal-thread" ... WAITING (parking)
at java.util.concurrent.CompletableFuture.get
at org.apache.maven.jline.FastTerminal.getTerminal(FastTerminal.java:68)
...
at org.jline.terminal.impl.ffm.CLibrary.<clinit>(CLibrary.java:369)
```
Also seen during startup:
```text
WARNING: Unable to find openpty native method in static libraries and unable
to load the util library.
- java.long.UnsatisfiedLinkError: no util in java.library.path: ...
```
## Suspected cause
A startup hang/regression in Maven `4.0.0-rc-6` involving JLine terminal
initialization (FFM path) and logging initialization.
The issue does not reproduce in `4.0.0-rc-5` with the same JDK and container.
## Workarounds
Any of the following avoids the hang for `rc-6` in this environment:
- `MAVEN_OPTS="-Dorg.jline.terminal.ffm=false"`
- `MAVEN_OPTS="-Dorg.jline.terminal.ffm=false -Dorg.jline.terminal.jni=true"`
- `MAVEN_OPTS="-Dorg.jline.terminal.providers=jni,exec
-Dorg.jline.terminal.ffm=false"`
## Notes
- This is reproducible with `mvn --version` only (no project build required).
- Network/download issues were ruled out.
- Wrapper script is not required to reproduce; direct Maven binary
invocation shows the same behavior for `rc-6`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]