[pve-devel] [RFC container] fix: shutdown: if lxc-stop fails, wait for socket closing with timeout
Friedrich Weber
f.weber at proxmox.com
Wed Jan 25 13:19:31 CET 2023
On 25/01/2023 09:25, Wolfgang Bumiller wrote:
> The general approach is fine, but `run_with_timeout` uses SIGALRM and
> messes with signal handlers which is rather inelegant for such a thing,
> we should limit its use to when we have no other option (mainly
> file-locking).
>
> For this case we can just use IO::Poll like:
>
> my $poll = IO::Poll->new();
> $poll->mask($sock => POLLIN | POLLHUP); # watch for input & EOF
> $poll->poll($shutdown_timeout);
>
> If the socket was closed, then `$poll->mask($sock)` should contain the
> `POLLHUP` bits.
Thanks for the suggestion, looks much nicer! I'll send a new version of
the patch.
More information about the pve-devel
mailing list