Skip to content

Commit 3347ca4

Browse files
author
MarcoFalke
committed
Merge #18526: Remove PID file at the very end
7fcdec0 Remove PID file at the very end (Hennadii Stepanov) Pull request description: While reproducing the bug from #18517, I've noticed that the `bitcoind.pid` file has already been removed when the `bitcoind` hangs. This PR makes `Shutdown()` keep the `bitcoind.pid` file available until the end. ACKs for top commit: MarcoFalke: ACK 7fcdec0 emilengler: utACK 7fcdec0 promag: Code review ACK 7fcdec0. theStack: Code review ACK 7fcdec0 Tree-SHA512: 9732ef34e137dbee70a06d922b316b8ea7b9a1c959cf8861b6940cd789336dc19ee468a4c3a28d95d1458076a48270c676b0ff27fec30cf57eced6ddab0a2a9b
2 parents 29893ec + 7fcdec0 commit 3347ca4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/init.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,20 +291,22 @@ void Shutdown(NodeContext& node)
291291
}
292292
#endif
293293

294-
try {
295-
if (!fs::remove(GetPidFile())) {
296-
LogPrintf("%s: Unable to remove PID file: File does not exist\n", __func__);
297-
}
298-
} catch (const fs::filesystem_error& e) {
299-
LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
300-
}
301294
node.chain_clients.clear();
302295
UnregisterAllValidationInterfaces();
303296
GetMainSignals().UnregisterBackgroundSignalScheduler();
304297
globalVerifyHandle.reset();
305298
ECC_Stop();
306299
if (node.mempool) node.mempool = nullptr;
307300
node.scheduler.reset();
301+
302+
try {
303+
if (!fs::remove(GetPidFile())) {
304+
LogPrintf("%s: Unable to remove PID file: File does not exist\n", __func__);
305+
}
306+
} catch (const fs::filesystem_error& e) {
307+
LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
308+
}
309+
308310
LogPrintf("%s: done\n", __func__);
309311
}
310312

0 commit comments

Comments
 (0)