Skip to content

Commit

Permalink
Handle non-PID 1 subreaper
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKozlov committed Jul 29, 2021
1 parent dec65be commit 066dd04
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/hotspot/os/linux/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6576,19 +6576,22 @@ static int call_criu() {
wait(NULL);
return 0;
}

pid_t parent_before = getpid();

// child
if (fork()) {
exit(0);
}
// grand-child
pid_t parent;
pid_t parent = getppid();
int tries = 300;
while (parent != 1 && 0 < tries--) {
::usleep(10);
parent = getppid();
}

if (parent != 1) {
if (parent == parent_before) {
trace_cr("can't move out of JVM process hierarchy");
union sigval sv = { .sival_int = -1 };
sigqueue(jvm, RESTORE_SIGNAL, sv);
Expand Down

0 comments on commit 066dd04

Please sign in to comment.