Bug 2092322
| Summary: | [QSD] pid file still exist after qsd process be killed when qsd run as daemonize | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | qing.wang <qinwang> |
| Component: | qemu-kvm | Assignee: | Hanna Czenczek <hreitz> |
| qemu-kvm sub component: | Storage | QA Contact: | qing.wang <qinwang> |
| Status: | CLOSED CURRENTRELEASE | Docs Contact: | |
| Severity: | low | ||
| Priority: | low | CC: | coli, jinzhao, juzhang, kwolf, lijin, qzhang, virt-maint, xuwei |
| Version: | 9.1 | Keywords: | Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-12-21 08:33:47 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
qing.wang
2022-06-01 09:34:17 UTC
The problem is that daemonizing changes the current working directory to /, so the PID file cannot be removed if it was specified by relative path. This is also true for qemu itself: $ pwd /tmp $ qemu-system-x86_64 --daemonize --pidfile qemu.pid $ kill $(cat qemu.pid) $ ls -l qemu.pid -rw------- 1 hreitz users 6 9. Jun 09:38 qemu.pid We should probably always expand the PID file path to absolute paths internally. It still exist even using absolute paths on Red Hat Enterprise Linux release 9.0 (Plow) 5.14.0-70.15.1.el9_0.x86_64 qemu-kvm-7.0.0-7.el9.x86_64 seabios-bin-1.15.0-1.el9.noarch edk2-ovmf-20220126gitbb1bba3d77-3.el9.noarch root@dell-per6515-03 /home $ qemu-storage-daemon --daemonize --pidfile /tmp/qemu.pid root@dell-per6515-03 /home $ ps -e ww|grep qemu-storage-daemon|grep -v grep 208762 ? Sl 0:00 qemu-storage-daemon --daemonize --pidfile /tmp/qemu.pid root@dell-per6515-03 /home $ kill -9 208762 root@dell-per6515-03 /home $ ls /tmp/qemu.pid /tmp/qemu.pid (In reply to qing.wang from comment #3) > root@dell-per6515-03 /home $ qemu-storage-daemon --daemonize --pidfile > /tmp/qemu.pid > root@dell-per6515-03 /home $ ps -e ww|grep qemu-storage-daemon|grep -v grep > 208762 ? Sl 0:00 qemu-storage-daemon --daemonize --pidfile > /tmp/qemu.pid > root@dell-per6515-03 /home $ kill -9 208762 If you kill the process via SIGKILL, it has no chance to delete the PID file. This should be the case with or without --daemonize. The PID file can only be deleted if the process is terminated such that atexit() handlers run, e.g. via SIGTERM (as done in comment 0) or SIGINT. Hanna verify on qemu-kvm-7.0.0-8.el9.x86_64: 1.qemu-storage-daemon --daemonize --pidfile /tmp/qemu.pid 2.kill -SIGTERM $(cat /tmp/qemu.pid) 3. ps -e ww|grep qemu-storage-daemon|grep -v grep 4. ls /tmp/qemu.pid ls: cannot access '/tmp/qemu.pid': No such file or director It get expected result. I suggest adding this to document or help message. |