diff options
author | Laszlo Csomor <laszlocsomor@google.com> | 2016-11-24 10:28:20 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-11-24 13:33:24 +0000 |
commit | 6450c187591bfbbd65766076f65f7c2901cc99bb (patch) | |
tree | 7f5e4025456b7e1b45f1de77f4efcfb8ed3388c2 /src/main/java/com/google | |
parent | 607030b642b26d3916555a983f1b343a71c63920 (diff) |
Bazel client: delete and don't use the server.pid
Upon startup the Bazel client checks if there's
already a running server process and if so then
connects to it.
We achieve this by checking if there's a symlink
in the server directory called served.pid,
pointing to /proc/<server_pid>. If so, we read the
symlink's target and extract the PID; otherwise we
check if there's a file in the server's directory
(server.pid.txt) that contains the PID and read it
from there.
Since the PID file is always there, we don't need
the symlink, plus on Windows we don't support
symlinks anyway, which is the real motivation for
this change.
Just ignoring the PID symlink is not enough, we
need to actively delete it so that switching
between Bazel versions (one that writes a PID
symlink and one that doesn't) won't result in
having a symlink and PID file with different
PIDs and clients trying to kill the wrong server
process / not killing one that they should.
See https://github.com/bazelbuild/bazel/issues/2107
--
MOS_MIGRATED_REVID=140117287
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java b/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java index 0c8791990e..ca7d3ea4f2 100644 --- a/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java +++ b/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java @@ -466,9 +466,7 @@ public class GrpcServerImpl implements RPCServer { // The client only accesses the pid file after connecting to the socket // which ensures that it gets the correct pid value. Path pidFile = serverDirectory.getRelative("server.pid.txt"); - Path pidSymlink = serverDirectory.getRelative("server.pid"); deleteAtExit(pidFile, /*deleteParent=*/ false); - deleteAtExit(pidSymlink, /*deleteParent=*/ false); this.commandExecutor = commandExecutor; this.clock = clock; |