* [pve-devel] [PATCH qemu-server] qmeventd: explicitly close() pidfds
@ 2021-02-09 15:24 Stefan Reiter
2021-02-11 16:17 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Reiter @ 2021-02-09 15:24 UTC (permalink / raw)
To: pve-devel
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>
---
I'm puzzled by this, and I'm not entirely sure this is the full fix, but it does
seem like a good idea to close the fds explicitly anyway.
qmeventd/qmeventd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/qmeventd/qmeventd.c b/qmeventd/qmeventd.c
index 57f1867..a14c331 100644
--- a/qmeventd/qmeventd.c
+++ b/qmeventd/qmeventd.c
@@ -600,6 +600,7 @@ sigkill(void *ptr, __attribute__((unused)) void *unused)
if (data.pidfd > 0) {
err = pidfd_send_signal(data.pidfd, SIGKILL, NULL, 0);
+ (void)close(data.pidfd);
} else {
err = kill(data.pid, SIGKILL);
}
@@ -619,6 +620,7 @@ static void
handle_forced_cleanup()
{
if (alarm_triggered) {
+ VERBOSE_PRINT("clearing forced cleanup backlog\n");
alarm_triggered = 0;
g_slist_foreach(forced_cleanups, sigkill, NULL);
g_slist_free_full(forced_cleanups, free);
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH qemu-server] qmeventd: explicitly close() pidfds
2021-02-09 15:24 [pve-devel] [PATCH qemu-server] qmeventd: explicitly close() pidfds Stefan Reiter
@ 2021-02-11 16:17 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2021-02-11 16:17 UTC (permalink / raw)
To: Proxmox VE development discussion, Stefan Reiter
On 09.02.21 16:24, Stefan Reiter wrote:
> 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>
> ---
>
> I'm puzzled by this, and I'm not entirely sure this is the full fix, but it does
> seem like a good idea to close the fds explicitly anyway.
>
> qmeventd/qmeventd.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-11 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 15:24 [pve-devel] [PATCH qemu-server] qmeventd: explicitly close() pidfds Stefan Reiter
2021-02-11 16:17 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox