From: Shmaya <34206053+ShmayaFrankel@users.noreply.github.com> Date: Fri, 11 Aug 2023 17:41:30 +0000 (+0000) Subject: Bug 4981: Work around in-call job invalidation bugs (#1428) X-Git-Tag: SQUID_7_0_1~372 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2149fc9aea418202fb49d0efd68bc3048ba01c6;p=thirdparty%2Fsquid.git 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. --- 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 }