Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DaemonClient.is_daemon_running does not check for stale pid file #6553

Open
danielhollas opened this issue Jul 30, 2024 · 1 comment
Open

Comments

@danielhollas
Copy link
Collaborator

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.

def _clean_potentially_stale_pid_file(self) -> None:

This function is called for example when running verdi daemon stop or verdi daemon start. Notably, it is NOT called inside the DaemonClient.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 running verdi process play|pause|kill command, which could silently be failing when the daemon is not actually running.

Related issues: #5934, #5933

@sphuber
Copy link
Contributor

sphuber commented Aug 19, 2024

This design decision was kind of intentional: #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants