mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-18 16:42:54 +01:00
Merge #18526: Remove PID file at the very end
7fcdec0f32Remove 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: ACK7fcdec0f32emilengler: utACK7fcdec0f32promag: Code review ACK7fcdec0f32. theStack: Code review ACK7fcdec0f32Tree-SHA512: 9732ef34e137dbee70a06d922b316b8ea7b9a1c959cf8861b6940cd789336dc19ee468a4c3a28d95d1458076a48270c676b0ff27fec30cf57eced6ddab0a2a9b
This commit is contained in:
16
src/init.cpp
16
src/init.cpp
@@ -291,13 +291,6 @@ void Shutdown(NodeContext& node)
|
|||||||
}
|
}
|
||||||
#endif
|
#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();
|
node.chain_clients.clear();
|
||||||
UnregisterAllValidationInterfaces();
|
UnregisterAllValidationInterfaces();
|
||||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||||
@@ -305,6 +298,15 @@ void Shutdown(NodeContext& node)
|
|||||||
ECC_Stop();
|
ECC_Stop();
|
||||||
if (node.mempool) node.mempool = nullptr;
|
if (node.mempool) node.mempool = nullptr;
|
||||||
node.scheduler.reset();
|
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__);
|
LogPrintf("%s: done\n", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user