init: do not rename the main thread in Shutdown()
Shutdown() called RenameThread("hush-shutoff") on the main thread. On
Linux that sets /proc/<pid>/comm, i.e. the process name, so for the
whole shutdown (wallet flush, chainstate flush, LevelDB closes) the node
no longer matched 'pgrep -x dragonxd' / pidof while it still held the
datadir and LevelDB locks. pgrep-based restart scripts took that as
"exited" and relaunched it early; on regtest pgrep stopped matching
about 1 s after 'stop' in 10/10 runs while the old process was alive.
Keep the process name until exit. Worker threads keep their own names.
Nothing depends on "hush-shutoff": no hit in src/, qa/, contrib/ or
util/, and the ObsidianDragon GUI only works around the rename by also
checking the exe link.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -211,9 +211,9 @@ void Shutdown()
|
||||
/// for example if the data directory was found to be locked.
|
||||
/// Be sure that anything that writes files or flushes caches only does this if the respective
|
||||
/// module was initialized.
|
||||
static char shutoffstr[128];
|
||||
sprintf(shutoffstr,"%s-shutoff","hush");
|
||||
RenameThread(shutoffstr);
|
||||
// Do not RenameThread() here: Shutdown() runs on the main thread, whose name is the process name
|
||||
// (/proc/<pid>/comm). Renaming it made 'pgrep -x dragonxd' stop matching a node that was still
|
||||
// shutting down and holding its locks, so pgrep-based restart scripts relaunched it too early.
|
||||
mempool.AddTransactionsUpdated(1);
|
||||
|
||||
if(fDebug) {
|
||||
|
||||
Reference in New Issue
Block a user