From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/4] qspawn: consistently return 500 on premature EOF
Date: Fri, 6 Jan 2023 10:10:52 +0000 [thread overview]
Message-ID: <20230106101053.1461700-4-e@80x24.org> (raw)
In-Reply-To: <20230106101053.1461700-1-e@80x24.org>
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 <<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:
next prev parent reply other threads:[~2023-01-06 10:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 10:10 [PATCH 0/4] www_coderepo vs cgit fallback fixes Eric Wong
2023-01-06 10:10 ` [PATCH 1/4] qspawn: use fallback response code from CGI program Eric Wong
2023-01-06 10:10 ` [PATCH 2/4] httpd/async: retry reads properly when parsing headers Eric Wong
2023-01-06 10:10 ` Eric Wong [this message]
2023-01-06 10:10 ` [PATCH 4/4] qspawn: fix EINTR with generic PSGI servers Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230106101053.1461700-4-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).