From c1b26477f9c60338ee1ebafd7d37628692ff7332 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 2 Apr 2019 00:45:48 +0000 Subject: viewvcs: check for premature EOF from git-cat-file Not entirely sure what is causing this, but it appears to be causing infinite loops when attempting to display certain blobs. Fortunately, the fair scheduling of public-inbox-httpd prevented this from becoming a real problem aside from increasing CPU usage. --- lib/PublicInbox/ViewVCS.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm index f5374517..ae721034 100644 --- a/lib/PublicInbox/ViewVCS.pm +++ b/lib/PublicInbox/ViewVCS.pm @@ -62,6 +62,10 @@ sub stream_large_blob ($$$$) { my $ct = 'text/plain; charset=UTF-8'; return [200, ['Content-Type', $ct, @cl] ]; } + if ($r == 0) { + warn "premature EOF on $oid $$logref\n"; + return html_page($ctx, 500, $logref); + } undef; # bref keeps growing } }); -- cgit v1.2.3-24-ge0c7