-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force kill testcluster nodes #37353
Force kill testcluster nodes #37353
Changes from 1 commit
6d08571
adadb5b
bff15cf
9539961
b4c3a97
1b2d1c4
efc3ae3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,22 +224,30 @@ synchronized void stop(boolean tailLogs) { | |
} | ||
logger.info("Stopping `{}`, tailLogs: {}", this, tailLogs); | ||
requireNonNull(esProcess, "Can't stop `" + this + "` as it was not started or already stopped."); | ||
stopHandle(esProcess.toHandle()); | ||
// Test clusters are not reused, don't spend time on a graceful shutdown | ||
stopHandle(esProcess.toHandle(), true); | ||
if (tailLogs) { | ||
logFileContents("Standard output of node", getStdoutFile()); | ||
logFileContents("Standard error of node", getStdErrFile()); | ||
} | ||
esProcess = null; | ||
} | ||
|
||
private void stopHandle(ProcessHandle processHandle) { | ||
private void stopHandle(ProcessHandle processHandle, boolean forcibly) { | ||
// Stop all children first, ES could actually be a child when there's some wrapper process like on Windows. | ||
if (processHandle.isAlive()) { | ||
processHandle.children().forEach(this::stopHandle); | ||
processHandle.children().forEach(each -> stopHandle(each, forcibly)); | ||
} | ||
logProcessInfo("Terminating elasticsearch process:", processHandle.info()); | ||
logProcessInfo( | ||
"Terminating elasticsearch process" + (forcibly ? " forcibly " : "gratefully") + ":", | ||
processHandle.info() | ||
); | ||
if (processHandle.isAlive()) { | ||
processHandle.destroy(); | ||
if (forcibly) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the order of this all can be cleaned up to not have doubling up on waits. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rjernst done, ready for review There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're still doing multiple aliveness checks when we already know it is killed. Here is what I was envisioning:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rjernst implemented as suggested |
||
processHandle.destroyForcibly(); | ||
} else { | ||
processHandle.destroy(); | ||
} | ||
} else { | ||
logger.info("Process was not running when we tried to terminate it."); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, should be "gracefully". Not say we are not grateful 😉