Skip to content

No timeout for external java process in doGetToolchainModel #170

Open

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:

Activity

  1. added a commit that references this issue on Oct 22, 2026
  2. added
    bug
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions