Skip to content

No timeout for external java process in doGetToolchainModel #170

Description

@elharo

Summary

launches a subprocess and calls without a timeout. A hung or slow JVM process will block Maven indefinitely.

Location

https://github.com/apache/maven-toolchains-plugin/blob/master/src/main/java/org/apache/maven/plugins/toolchain/jdk/ToolchainDiscoverer.java#L243-L250

Code

Problem

without arguments blocks forever until the process completes. If the discovered JDK's java binary is:

  • A script that hangs
  • A broken/corrupted installation
  • An interactive shell
  • Extremely slow (e.g., on a network filesystem)

Maven will hang indefinitely with no way to recover other than killing the process.

Impact

During JDK toolchain discovery, a single problematic JDK installation can cause the entire Maven build to hang permanently. Since discovery scans many directories (including user-controlled paths like , , etc.), a corrupted or slow JDK in any of these locations blocks the build.

Suggested Fix

Use with a reasonable timeout (e.g., 30 seconds), and if the process times out, destroy it and log a warning:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions