openjdk/jdk · error
GetExitCodeProcess failed: %lu
Error message
GetExitCodeProcess failed: %lu
What it means
Windows launcher relauncher: after the spawned java process finished (or the wait failed), GetExitCodeProcess(pi.hProcess, &exit_code) returned FALSE, so the relauncher cannot forward java's exit status to the caller and returns 1. The message prints GetLastError(). Like the wait failure, on a healthy system this is nearly unreachable; it points at handle or process state corruption.
Source
Thrown at src/java.base/windows/native/launcher/relauncher.c:239
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
memset(&pi, 0, sizeof(pi));
// Windows has no equivalent of exec, so start the process and wait for it
// to finish, to be able to return the same exit code
if (!CreateProcess(java_path, command_line, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
fprintf(stderr, "CreateProcess failed: %lu\n", GetLastError());
return 1;
}
if (WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_FAILED) {
fprintf(stderr, "WaitForSingleObject failed: %lu\n", GetLastError());
return 1;
}
DWORD exit_code;
if (!GetExitCodeProcess(pi.hProcess, &exit_code)) {
fprintf(stderr, "GetExitCodeProcess failed: %lu\n", GetLastError());
return 1;
}
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return exit_code;
}
View on GitHub (pinned to 88dfb74bbe)
Solutions
- Check the printed GetLastError() value (ERROR_INVALID_HANDLE = 6 is the classic one) to confirm handle corruption
- Launch bin\java.exe directly, bypassing the relauncher and any wrapper, to verify correct behavior
- Fix or update the service wrapper/supervisor so it does not close or steal child process handles
- Collect an hs-err file / Windows event log for the child if the security software is suspected of killing it
Defensive patterns
Strategy: fallback
Prevention
- Ensure service wrappers pass (and do not close) the child process handle they wait on
- Check the child's real exit status via its own logs/hs-err when the relauncher cannot propagate it
When it happens
Trigger: pi.hProcess is invalid (closed by external code, job-object policies), or the process object is in a state where the exit code cannot be queried — typically caused by injected DLLs, handle-duplication bugs in launch wrappers, or antivirus terminating the child abnormally.
Common situations: Java launched via custom Windows service wrappers or process supervisors that mishandle inherited handles; endpoint-security software killing the child; debugging scenarios where the child was attached/detached oddly.
Related errors
- no '\' found in the full path of the executable
- WaitForSingleObject failed: %lu
- failed to get the full path of the executable: %lu
- CreateProcess failed: %lu
- no '/' found in the full path of the executable
AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14).
Data as JSON: /api/errors/b73a0b36d070f525.
Report an issue: GitHub.