Open danielhollas opened 3 months ago
This design decision was kind of intentional: https://github.com/aiidateam/aiida-core/pull/5940 I still feel this behavior is kind of justified because having to check whether the PID file is stale each time the status of the daemon is checked bears a non-negligible cost and this situation typically only occurs when a system is shutdown in a hard manner.
The way that we determine whether a daemon is running currently involves reading PID of its process from its PID file.
We also have a mechanism that checks whether such PID file is stale (such as when the daemon is stopped ungracefully). This is defined in function
self._clean_potentially_stale_pid_file
.https://github.com/aiidateam/aiida-core/blob/7402c17755b332cc9a06e88516621e575f0d1cce/src/aiida/engine/daemon/client.py#L577
This function is called for example when running
verdi daemon stop
orverdi daemon start
. Notably, it is NOT called inside theDaemonClient.is_daemon_running
which is used in various places around AiiDA.I fully realize that this might not be a bug per se, and is perhaps intended due to a fragile nature of
clean_potentially_stale_pid_file
, but it certainly seems like this may result in inconsistent behaviour, for example when runningverdi process play|pause|kill
command, which could silently be failing when the daemon is not actually running.Related issues: #5934, #5933