rpmdb_lock.pid: No lock for wrong old pid #2273
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When dnf-install is killed or exited abnormally, a PID will remain in the rpmdb_lock.pid, and when the system runs for a period of time, the PID will be reused, and at this time, the command will be stuck when the dnf operation (such as dnf install) is performed again. Therefore, it is not sufficient to detect whether the PID exists, and the creation time of rpmdb_lock.pid needs to be later than the startup time of pid=PID process is to solve this problem.
How to reproduce:
terminal 1: write a bad pid to lock file
terminal 2: try install rpm to access rpmdb_lock.pid file
Before this patch, the dnf-reinstall will 'Waiting for process 1', after this commit, the dnf-reinstall will continue to running, because pid=1 is bad pid, it's belongs to systemd.
Add depends python3-psutil.