------------------------------------------------------------ revno: 14179 revision-id: squid3@treenet.co.nz-20170701095916-wknqmneq2w0mxt6a parent: squid3@treenet.co.nz-20170701081116-xekwolj1wdkeaxqv author: Alex Rousskov committer: Amos Jeffries branch nick: 3.5 timestamp: Sat 2017-07-01 21:59:16 +1200 message: Fix mgr query handoff from the original recipient to Coordinator. This bug has already been fixed once, in trunk r11164.1.61, but that fix was accidentally undone shortly after, during significant cross-branch merging activity combined with the Forwarder class split. The final merge importing the associated code (trunk r11730) was buggy. The bug (explained in r11164.1.61) leads to a race condition between * Store notifying Server classes about the entry completion (which might trigger a bogus error message sent to the cache manager client while Coordinator sends its own valid response on the same connection!) and * post-cleanup() connection closure handlers of Server classes silently closing everything (and leaving Coordinator the only responding process on that shared connection). The bug probably was not noticed for so long because, evidently, the latter actions tend to win in the current code. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20170701095916-wknqmneq2w0mxt6a # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: c7e89c80468c7f388f7e09ad2d68a245789db50d # timestamp: 2017-07-01 10:51:12 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20170701081116-\ # xekwolj1wdkeaxqv # # Begin patch === modified file 'src/ipc/Forwarder.h' --- src/ipc/Forwarder.h 2017-01-01 00:16:45 +0000 +++ src/ipc/Forwarder.h 2017-07-01 09:59:16 +0000 @@ -47,12 +47,14 @@ virtual void handleError(); virtual void handleTimeout(); virtual void handleException(const std::exception& e); - virtual void handleRemoteAck(); private: static void RequestTimedOut(void* param); void requestTimedOut(); void removeTimeoutEvent(); + + void handleRemoteAck(); + static AsyncCall::Pointer DequeueRequest(unsigned int requestId); protected: === modified file 'src/mgr/Forwarder.cc' --- src/mgr/Forwarder.cc 2017-01-01 00:16:45 +0000 +++ src/mgr/Forwarder.cc 2017-07-01 09:59:16 +0000 @@ -102,17 +102,6 @@ mustStop("commClosed"); } -/// called when Coordinator starts processing the request -void -Mgr::Forwarder::handleRemoteAck() -{ - Ipc::Forwarder::handleRemoteAck(); - - Must(entry != NULL); - EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT); - entry->complete(); -} - /// send error page void Mgr::Forwarder::sendError(ErrorState *error) === modified file 'src/mgr/Forwarder.h' --- src/mgr/Forwarder.h 2017-01-01 00:16:45 +0000 +++ src/mgr/Forwarder.h 2017-07-01 09:59:16 +0000 @@ -40,7 +40,6 @@ virtual void handleError(); virtual void handleTimeout(); virtual void handleException(const std::exception& e); - virtual void handleRemoteAck(); private: void noteCommClosed(const CommCloseCbParams& params); === modified file 'src/tests/stub_libmgr.cc' --- src/tests/stub_libmgr.cc 2017-01-01 00:16:45 +0000 +++ src/tests/stub_libmgr.cc 2017-07-01 09:59:16 +0000 @@ -100,7 +100,6 @@ void Mgr::Forwarder::handleError() STUB void Mgr::Forwarder::handleTimeout() STUB void Mgr::Forwarder::handleException(const std::exception& e) STUB -void Mgr::Forwarder::handleRemoteAck() STUB #include "mgr/FunAction.h" Mgr::Action::Pointer Mgr::FunAction::Create(const CommandPointer &cmd, OBJH *aHandler) STUB_RETVAL(dummyAction)