about summary refs log tree commit homepage
path: root/lib/PublicInbox/Qspawn.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-06 10:10:52 +0000
committerEric Wong <e@80x24.org>2023-01-06 10:24:16 +0000
commit5b92ed1384511d1a16813aabd7c902d93b87603b (patch)
treeaf1612fbffb45b355e5d215112126d7caff549f9 /lib/PublicInbox/Qspawn.pm
parenta12cd80b5821cf5cb2c8672aad0fba94c451f728 (diff)
downloadpublic-inbox-5b92ed1384511d1a16813aabd7c902d93b87603b.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/Qspawn.pm')
-rw-r--r--lib/PublicInbox/Qspawn.pm7
1 files changed, 7 insertions, 0 deletions
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 <<EOM;
+EOF parsing headers from @$cmd ($self->{psgi_env}->{REQUEST_URI})
+EOM
+                                $ret = [ 500, [], [ "Internal error\n" ] ];
                         }
                 } else {
                         # caller should notify us when it's ready: