Skip to content

Commit 489658d

Browse files
committed
8307885: com/sun/jdi/ConnectedVMs.java fails with "Invalid debuggee exitValue: 0"
Reviewed-by: kevinw, sspitsyn
1 parent 9ad38cb commit 489658d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/jdk/com/sun/jdi/ConnectedVMs.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,19 @@ public static void main(String args[]) throws Exception {
6969
protected boolean allowedExitValue(int exitValue) {
7070
if (passName.equals("Kill")) {
7171
// 143 is SIGTERM, which we expect to get when doing a Process.destroy(),
72-
// unless we are on Windows, which will exit with a 1.
72+
// unless we are on Windows, which will exit with a 1. However, sometimes
73+
// there is a race and the main thread exits before SIGTERM can force
74+
// an exit(143), so we need to allow exitValue 0 also.
7375
if (!Platform.isWindows()) {
74-
return exitValue == 143;
76+
return exitValue == 143 || exitValue == 0;
7577
} else {
76-
return exitValue == 1;
78+
return exitValue == 1 || exitValue == 0;
7779
}
7880
} else if (passName.equals("exit()")) {
7981
// This version of the test does an exit(1), so that's what we expect.
80-
return exitValue == 1;
82+
// But similar to the SIGTERM race issue, the exit(1) might not happen
83+
// before the main thread exits, so we need to expect 0 also.
84+
return exitValue == 1 || exitValue == 0;
8185
}
8286
return super.allowedExitValue(exitValue);
8387
}

0 commit comments

Comments
 (0)