From 5b92ed1384511d1a16813aabd7c902d93b87603b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Jan 2023 10:10:52 +0000 Subject: [PATCH] qspawn: consistently return 500 on premature EOF If {parse_hdr} callback doesn't handle it, we need to break the loop if the CGI process dies prematurely. This doesn't fix a currently known problem, but theoretically a SIGKILL could hit (cgit || git-http-backend) while -netd or -httpd survives. --- lib/PublicInbox/Qspawn.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index 7984e35a..5d3ec309 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -210,6 +210,13 @@ sub rd_hdr ($) { if ($@) { warn "parse_hdr: $@"; $ret = [ 500, [], [ "Internal error\n" ] ]; + } elsif (!defined($ret) && !$r) { + my $cmd = $self->{cmd} // [ '(?)' ]; + my $env = $self->{psgi_env}; + warn <{psgi_env}->{REQUEST_URI}) +EOM + $ret = [ 500, [], [ "Internal error\n" ] ]; } } else { # caller should notify us when it's ready: -- 2.44.0