From d2149fc9aea418202fb49d0efd68bc3048ba01c6 Mon Sep 17 00:00:00 2001 From: Shmaya <34206053+ShmayaFrankel@users.noreply.github.com> Date: Fri, 11 Aug 2023 17:41:30 +0000 Subject: [PATCH] Bug 4981: Work around in-call job invalidation bugs (#1428) Bug 4981 is one known case of such invalidation, but this workaround is much broader than that bug context. We can speculate that architectural problems described in commit e3b6f15 are behind (some of) these bugs. --- src/base/AsyncJobCalls.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/base/AsyncJobCalls.h b/src/base/AsyncJobCalls.h index 64d27a5855..faa3e49bd3 100644 --- a/src/base/AsyncJobCalls.h +++ b/src/base/AsyncJobCalls.h @@ -176,9 +176,18 @@ JobDialer::dial(AsyncCall &call) } catch (const std::exception &e) { debugs(call.debugSection, 3, call.name << " threw exception: " << e.what()); + if (!job) { + debugs(call.debugSection, DBG_CRITICAL, "ERROR: Squid BUG: Job invalidated during " << + call.name << " that threw exception: " << e.what()); + return; // see also: bug 4981, commit e3b6f15, and XXX in Http::Stream class description + } job->callException(e); } + if (!job) { + debugs(call.debugSection, DBG_CRITICAL, "ERROR: Squid BUG: Job invalidated during " << call.name); + return; + } job->callEnd(); // may delete job } -- 2.47.2