From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id ABAC41F47F for ; Fri, 6 Jan 2023 10:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1672999861; bh=GtOKa9w38sM1gjSWDGTMzMcY49Sj0ZTdvv0gGGjkVjA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tSTxZ3EaUlIf66OsQ1Jso2JMZSCTVg3MITEkUybzsCmWN2+2t/je3qWLjFBbMbpB9 Yy+EdICwTd7e7a4ansDtd4u874qLcS5VdzBy9E54goMiW9UxDXF0Opr0L3OL/2LPhT n83b7PtpbxhIGT2RuE9m6ccojOgrk9q47mpg1NHs= From: Eric Wong 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 Message-Id: <20230106101053.1461700-4-e@80x24.org> In-Reply-To: <20230106101053.1461700-1-e@80x24.org> References: <20230106101053.1461700-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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: