[pve-devel] [PATCH http-server] fix #3807: don't attempt response on closed handle

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Dec 29 12:15:34 CET 2021


if a client closes the connection while the API server is
waiting/stalling here, the handle will disappear, and sending a response
is no longer possible.

(this issue is only cosmetic, but if such clients are a regular
occurrence it might get quite noisy in the logs)

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/PVE/APIServer/AnyEvent.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index f0305b3..4a99c77 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -361,6 +361,7 @@ sub response {
     } elsif ($delay && $delay > 0) {
 	my $w; $w = AnyEvent->timer(after => $delay, cb => sub {
 	    undef $w; # delete reference
+	    return if !$reqstate->{hdl}; # already disconnected
 	    $reqstate->{hdl}->push_write($res);
 	    $self->finish_response($reqstate);
 	});
-- 
2.30.2






More information about the pve-devel mailing list