user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH 0/2] viewvcs: fix streaming large blobs
@ 2020-03-30 18:30 Eric Wong
  2020-03-30 18:30 ` [PATCH 1/2] qspawn: capture errors from parse_hdr callback Eric Wong
  2020-03-30 18:30 ` [PATCH 2/2] viewvcs: stream_blob_parse_hdr: fix BIN_DETECT retries Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2020-03-30 18:30 UTC (permalink / raw)
  To: meta

Eric Wong (2):
  qspawn: capture errors from parse_hdr callback
  viewvcs: stream_blob_parse_hdr: fix BIN_DETECT retries

 lib/PublicInbox/Qspawn.pm  | 6 +++++-
 lib/PublicInbox/ViewVCS.pm | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] qspawn: capture errors from parse_hdr callback
  2020-03-30 18:30 [PATCH 0/2] viewvcs: fix streaming large blobs Eric Wong
@ 2020-03-30 18:30 ` Eric Wong
  2020-03-30 18:30 ` [PATCH 2/2] viewvcs: stream_blob_parse_hdr: fix BIN_DETECT retries Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2020-03-30 18:30 UTC (permalink / raw)
  To: meta

User-supplied callbacks may fail, so capture the error instead
of propagating it up the stack into the public-inbox-httpd event
loop.
---
 lib/PublicInbox/Qspawn.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index 34b6912f..aebcb1f7 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -234,7 +234,11 @@ sub rd_hdr ($) {
 				length($$hdr_buf));
 		if (defined($r)) {
 			$total_rd += $r;
-			$ret = $ph_cb->($total_rd, $hdr_buf, $ph_arg);
+			eval { $ret = $ph_cb->($total_rd, $hdr_buf, $ph_arg) };
+			if ($@) {
+				log_err($self->{psgi_env}, "parse_hdr: $@");
+				$ret = [ 500, [], [ "Internal error\n" ] ];
+			}
 		} else {
 			# caller should notify us when it's ready:
 			return if $! == EAGAIN;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] viewvcs: stream_blob_parse_hdr: fix BIN_DETECT retries
  2020-03-30 18:30 [PATCH 0/2] viewvcs: fix streaming large blobs Eric Wong
  2020-03-30 18:30 ` [PATCH 1/2] qspawn: capture errors from parse_hdr callback Eric Wong
@ 2020-03-30 18:30 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2020-03-30 18:30 UTC (permalink / raw)
  To: meta

git-cat-file(1) may return less than the $BIN_DETECT value for
some blobs, so ensure we repopulate the values in $ctx for
retries in that case, otherwise we'll lose `$ctx->{-res}' and
die when attempting to use `undef' as an array ref.
---
 lib/PublicInbox/ViewVCS.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm
index 069937c1..9ec04f48 100644
--- a/lib/PublicInbox/ViewVCS.pm
+++ b/lib/PublicInbox/ViewVCS.pm
@@ -58,6 +58,7 @@ sub stream_blob_parse_hdr { # {parse_hdr} for Qspawn
 			warn "premature EOF on $oid $$logref\n";
 			return html_page($ctx, 500, $logref);
 		}
+		@$ctx{qw(-res -logref)} = ($res, $logref);
 		undef; # bref keeps growing
 	}
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-30 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 18:30 [PATCH 0/2] viewvcs: fix streaming large blobs Eric Wong
2020-03-30 18:30 ` [PATCH 1/2] qspawn: capture errors from parse_hdr callback Eric Wong
2020-03-30 18:30 ` [PATCH 2/2] viewvcs: stream_blob_parse_hdr: fix BIN_DETECT retries Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).