mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 13:49:50 +00:00
qmeventd: explicitly close() pidfds
In most circumstances a pidfd gets closed automatically once the child dies, and that *should* be guaranteed by us calling SIGKILL - however, it seems that sometimes that doesn't happen, leading to leaked file descriptors[0]. Also add a small note to verbose mode showing when the late-cleanup actually happens, helped during debug. [0] https://forum.proxmox.com/threads/cannot-shutdown-vm.83911/ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
5c3f782554
commit
0a279963b6
@ -600,6 +600,7 @@ sigkill(void *ptr, __attribute__((unused)) void *unused)
|
|||||||
|
|
||||||
if (data.pidfd > 0) {
|
if (data.pidfd > 0) {
|
||||||
err = pidfd_send_signal(data.pidfd, SIGKILL, NULL, 0);
|
err = pidfd_send_signal(data.pidfd, SIGKILL, NULL, 0);
|
||||||
|
(void)close(data.pidfd);
|
||||||
} else {
|
} else {
|
||||||
err = kill(data.pid, SIGKILL);
|
err = kill(data.pid, SIGKILL);
|
||||||
}
|
}
|
||||||
@ -619,6 +620,7 @@ static void
|
|||||||
handle_forced_cleanup()
|
handle_forced_cleanup()
|
||||||
{
|
{
|
||||||
if (alarm_triggered) {
|
if (alarm_triggered) {
|
||||||
|
VERBOSE_PRINT("clearing forced cleanup backlog\n");
|
||||||
alarm_triggered = 0;
|
alarm_triggered = 0;
|
||||||
g_slist_foreach(forced_cleanups, sigkill, NULL);
|
g_slist_foreach(forced_cleanups, sigkill, NULL);
|
||||||
g_slist_free_full(forced_cleanups, free);
|
g_slist_free_full(forced_cleanups, free);
|
||||||
|
Loading…
Reference in New Issue
Block a user