8173817: StackOverflowError in "process reaper" thread
Switch to inner class to avoid lambda stack overhead in ProcessReaper Reviewed-by: dholmes, martin
This commit is contained in:
parent
312f813dbb
commit
9c6245db87
@ -132,7 +132,9 @@ final class ProcessHandleImpl implements ProcessHandle {
|
|||||||
// newCompletion has just been installed successfully
|
// newCompletion has just been installed successfully
|
||||||
completion = newCompletion;
|
completion = newCompletion;
|
||||||
// spawn a thread to wait for and deliver the exit value
|
// spawn a thread to wait for and deliver the exit value
|
||||||
processReaperExecutor.execute(() -> {
|
processReaperExecutor.execute(new Runnable() {
|
||||||
|
// Use inner class to avoid lambda stack overhead
|
||||||
|
public void run() {
|
||||||
int exitValue = waitForProcessExit0(pid, shouldReap);
|
int exitValue = waitForProcessExit0(pid, shouldReap);
|
||||||
if (exitValue == NOT_A_CHILD) {
|
if (exitValue == NOT_A_CHILD) {
|
||||||
// pid not alive or not a child of this process
|
// pid not alive or not a child of this process
|
||||||
@ -160,6 +162,7 @@ final class ProcessHandleImpl implements ProcessHandle {
|
|||||||
newCompletion.complete(exitValue);
|
newCompletion.complete(exitValue);
|
||||||
// remove from cache afterwards
|
// remove from cache afterwards
|
||||||
completions.remove(pid, newCompletion);
|
completions.remove(pid, newCompletion);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user