]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4981: Work around in-call job invalidation bugs (#1428)
authorShmaya <34206053+ShmayaFrankel@users.noreply.github.com>
Fri, 11 Aug 2023 17:41:30 +0000 (17:41 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 12 Aug 2023 12:40:46 +0000 (12:40 +0000)
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

index 64d27a58552c164a05c6282f1e046556d7743106..faa3e49bd392aaf08aef8fbbcfcbb618e60292bd 100644 (file)
@@ -176,9 +176,18 @@ JobDialer<Job>::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
 }