Skip to content

Commit

Permalink
Fix bug: FE pid file has wrong content(#1273)
Browse files Browse the repository at this point in the history
For example, we start the process for the first time. The pid is 12345. Due to the accident, the process is killed and the fe.pid exists. Then we start the process for the second time. The pid is 6789. The fe.pid shows 67895 , Because file.write only cover the first four digits. This case can happen easily when we use supervise. Then I add the file.setLength(0) and delete the old data.
  • Loading branch information
liuchengshishabi authored and imay committed Jun 10, 2019
1 parent 8cd29d1 commit 2efd5a4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fe/src/main/java/org/apache/doris/PaloFe.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ private static boolean createAndLockPidFile(String pidFilePath) throws IOExcepti
pid.deleteOnExit();

String name = ManagementFactory.getRuntimeMXBean().getName();
file.setLength(0);
file.write(name.split("@")[0].getBytes(Charsets.UTF_8));

return true;
Expand Down

0 comments on commit 2efd5a4

Please sign in to comment.