From: Eduard Bagdasaryan Date: Thu, 4 Jun 2020 11:23:31 +0000 (+0000) Subject: Preserve caller context across ping timeout events (#635) X-Git-Tag: SQUID_5_0_4~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b2bbd797269c2d64c477c589f06f7b4b3691bb7;p=thirdparty%2Fsquid.git Preserve caller context across ping timeout events (#635) PeerSelector was losing its transaction context while handling an event-driven timeout. Also, the old code generating HandlePingTimeout event was problematic for two reasons: * it used raw 'this' for cbdata-protected child class. Sooner or later, code like this leads to "real" bugs similar to those fixed in ce9bb79, 38a9f55 / 9e64d84, and 4299f87. * It (mis)used event API for the transaction-specific purpose. We created a new "ping timeout service" that keeps at most one transaction-agnostic event.h timeout at any given time while maintaining an internal list of transactions awaiting a ping response. Similar architecture was used for HappyConnOpener helper services. We rejected the alternative idea of enhancing event API to support asynchronous calls because event.cc internals were never meant to handle thousands of concurrently pending transaction-related timeouts on busy proxies. While it would be possible to enhance those internals as well, timeout services offer an even better performance, are much easier to enhance to support timeout reconfigurations, and offer better "Squid state" debugging. --- diff --git a/src/PingData.h b/src/PingData.h index c524925421..a1fc8501fd 100644 --- a/src/PingData.h +++ b/src/PingData.h @@ -16,7 +16,7 @@ class PeerSelector; class PeerSelectorPingMonitor; -typedef std::pair WaitingPeerSelector; +typedef std::pair WaitingPeerSelector; /// waiting PeerSelector objects, ordered by their absolute deadlines typedef std::multimap, PoolingAllocator > WaitingPeerSelectors; typedef WaitingPeerSelectors::iterator WaitingPeerSelectorPosition;