Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mxqd hold a flock lock on /dev/shm/mxqd.HOST.DAEMON.lck to avoid being run multiple times. The open file and the lock is inherited by forked children. It is lost when the child does an execve(), because the file is opened O_CLOEXEC. However, the reaper is a long running forked child which doesen't do execve(), so it holds the lock as well. Usually this isn't a problem, because if mxqd terminates via one of the signals defined for that purpose, it will unlink the lock file before terminating. When it is restarted, a new file is generated and the lock on the new file is not in conflict with locks on the unlinked file. Only if mqxd is terminated by SIGKILL (which can't be ignored or handled) it does not clean up the lock file. In that case, trying to restart the daemon can fail because of the locks held by jobs of the previous daemon. Unlock the lock in the reaper after it has been forked.
- Loading branch information