Skip to content
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

blaze_util_posix: handle killpg failures #18299

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/main/cpp/blaze_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,12 @@ void ReleaseLock(BlazeLock* blaze_lock) {

bool KillServerProcess(int pid, const blaze_util::Path& output_base) {
// Kill the process and make sure it's dead before proceeding.
killpg(pid, SIGKILL);
errno = 0;
if (killpg(pid, SIGKILL) == -1) {
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
<< "Attempted to kill stale server process (pid=" << pid
<< ") using SIGKILL: " << GetLastErrorString();
}
if (!AwaitServerProcessTermination(pid, output_base,
kPostKillGracePeriodSeconds)) {
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
Expand Down