From d32b34dcfb3ee0f1e8a7f6fefb5c1eedaa71d09e Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Sun, 27 Jan 2013 21:13:51 -0700 Subject: [PATCH] Bug 3111: Mid-term fix for the forward.cc "err" assertion. The assert is triggered when a close handler for the server connection destroys FwdState before we have received anything from the origin server. Instead of asserting, we now respond with a 502 (Bad Gateway) ERR_READ_ERROR. That error seems the most appropriate single choice among available ones, but it may be misleading (in access.log) when the close handler was called due to client problems. Hopefully, another error will be logged in most of those cases. --- src/forward.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/forward.cc b/src/forward.cc index f51f57b807..00e0b7877a 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -220,6 +220,8 @@ FwdState::completed() if (entry->store_status == STORE_PENDING) { if (entry->isEmpty()) { + if (!err) // we quit (e.g., fd closed) before an error or content + fail(new ErrorState(ERR_READ_ERROR, HTTP_BAD_GATEWAY, request)); assert(err); errorAppendEntry(entry, err); err = NULL; -- 2.47.2