openjdk/jdk · error · IOException
Server failed to initialize: {}
Error message
Server failed to initialize: {} What it means
IOException from Client.startNewServer(): the client forked a javacserver daemon process, but it failed to initialize (the awaited readiness signal threw), so the client logs the daemon's entire stdout/stderr and its exit code, then rethrows with the original exception as cause. The daemon's output printed just before this exception is the primary diagnostic.
Source
Thrown at make/langtools/tools/javacserver/client/Client.java:188
// Throws an IOException if no valid values materialize
conf.portFile().waitForValidValues();
} catch (IOException ex) {
// Process was started, but server failed to initialize. This could
// for instance be due to the JVM not finding the server class,
// or the server running in to some exception early on.
Log.error("javacserver server process failed to initialize: " + ex.getMessage());
Log.error("Process output:");
Reader serverStdoutStderr = new InputStreamReader(serverProcess.getInputStream());
try (BufferedReader br = new BufferedReader(serverStdoutStderr)) {
br.lines().forEach(Log::error);
}
Log.error("<End of process output>");
try {
Log.error("Process exit code: " + serverProcess.exitValue());
} catch (IllegalThreadStateException e) {
// Server is presumably still running.
}
throw new IOException("Server failed to initialize: " + ex.getMessage(), ex);
}
}
}
View on GitHub (pinned to 88dfb74bbe)
Solutions
- Read the 'Process output:' block in the log — it contains the daemon's actual startup error.
- Check the 'Process exit code' line: non-zero exit usually means JVM options/classpath issues; missing exit code means it hung.
- Verify the port file directory is writable and not full.
- Remove stale port files and leftover server processes, then retry so a clean daemon is forked.
Defensive patterns
Strategy: fallback
Validate before calling
// pre-flight the forked JVM command before relying on the server
String javaBin = Paths.get(System.getProperty("java.home"), "bin", "java").toString();
ProcessBuilder check = new ProcessBuilder(javaBin, "-version").redirectErrorStream(true);
if (check.start().waitFor() != 0)
throw new IOException("cannot start a JVM for javacserver: " + javaBin); Try / catch
try {
client.startNewServer();
} catch (IOException e) {
// message already contains the daemon's stdout/stderr; fall back to in-process javac
Log.error("javacserver unavailable, falling back to local javac", e);
runLocalJavac(args); // graceful degradation instead of failing the build
} Prevention
- Validate that the build JVM can fork (memory limits, exec permissions) before enabling the server.
- Keep the port-file directory writable and on a local filesystem.
- Capture daemon output (the client already logs it) in CI artifacts for post-mortem.
When it happens
Trigger: The spawned server JVM exits or hangs during startup — incompatible JVM options, port file creation failure (permissions on the port file directory), or a classpath problem in the forked command.
Common situations: java.home changed after a JDK upgrade so the fork command is stale; the /tmp or build dir used for the port file is not writable; memory limits (ulimit/cgroups) preventing the second JVM from starting.
Related errors
- Could not connect to server after {} attempts with timeout {
- No port file values materialized. Giving up after {} ms
- Error Context: %s>>>%c<<<%s
- CompileProperties failed.
- genstubs failed
AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14).
Data as JSON: /api/errors/d66ae27dc0f55482.
Report an issue: GitHub.