Merge #18526: Remove PID file at the very end
7fcdec0f32
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: ACK7fcdec0f32
emilengler: utACK7fcdec0f32
promag: Code review ACK7fcdec0f32
. theStack: Code review ACK7fcdec0f32
Tree-SHA512: 9732ef34e137dbee70a06d922b316b8ea7b9a1c959cf8861b6940cd789336dc19ee468a4c3a28d95d1458076a48270c676b0ff27fec30cf57eced6ddab0a2a9b
This commit is contained in:
commit
3347ca4881
1 changed files with 9 additions and 7 deletions
16
src/init.cpp
16
src/init.cpp
|
@ -291,13 +291,6 @@ void Shutdown(NodeContext& node)
|
|||
}
|
||||
#endif
|
||||
|
||||
try {
|
||||
if (!fs::remove(GetPidFile())) {
|
||||
LogPrintf("%s: Unable to remove PID file: File does not exist\n", __func__);
|
||||
}
|
||||
} catch (const fs::filesystem_error& e) {
|
||||
LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
|
||||
}
|
||||
node.chain_clients.clear();
|
||||
UnregisterAllValidationInterfaces();
|
||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||
|
@ -305,6 +298,15 @@ void Shutdown(NodeContext& node)
|
|||
ECC_Stop();
|
||||
if (node.mempool) node.mempool = nullptr;
|
||||
node.scheduler.reset();
|
||||
|
||||
try {
|
||||
if (!fs::remove(GetPidFile())) {
|
||||
LogPrintf("%s: Unable to remove PID file: File does not exist\n", __func__);
|
||||
}
|
||||
} catch (const fs::filesystem_error& e) {
|
||||
LogPrintf("%s: Unable to remove PID file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
|
||||
}
|
||||
|
||||
LogPrintf("%s: done\n", __func__);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue