aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2016-05-04 09:39:48 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-05-04 09:55:09 +0000
commitb29db48104740bdc3bf43cc1e9f3417599fba1e4 (patch)
treea87438faea9df5d806009fa207cc6b52406f2571 /src
parentf1f24fc4b5aa83b7a4b872ec8f1c3a369799c081 (diff)
Make the Blaze server kill the previous instance if the start time file doesn't exist.
It may be an old version that doesn't know how to write them yet. -- MOS_MIGRATED_REVID=121462577
Diffstat (limited to 'src')
-rw-r--r--src/main/cpp/blaze_util_linux.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/cpp/blaze_util_linux.cc b/src/main/cpp/blaze_util_linux.cc
index 4be6fd3e5a..5a3ce94e30 100644
--- a/src/main/cpp/blaze_util_linux.cc
+++ b/src/main/cpp/blaze_util_linux.cc
@@ -230,15 +230,14 @@ void KillServerProcess(
}
string recorded_start_time;
- if (!ReadFile(blaze_util::JoinPath(output_base, "server/server.starttime"),
- &recorded_start_time)) {
- // start time file got deleted, but PID file didn't. This is strange. Let's
- // not kill a random process. Note that this makes Blaze unable to kill
- // hung servers that do not write a server.starttime file.
- return;
- }
-
- if (recorded_start_time != start_time) {
+ bool file_present = ReadFile(
+ blaze_util::JoinPath(output_base, "server/server.starttime"),
+ &recorded_start_time);
+
+ // start time file got deleted, but PID file didn't. This is strange.
+ // Assume that this is an old Blaze process that doesn't know how to write
+ // start time files yet.
+ if (file_present && recorded_start_time != start_time) {
// This is a different process.
fprintf(stderr, "PID %d got reused. Not killing the process.\n", pid);
return;