]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 5048: ResolvedPeers.cc:35: "found != paths_.end()" assertion (#680)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Fri, 26 Jun 2020 20:06:29 +0000 (20:06 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 26 Jun 2020 23:20:52 +0000 (23:20 +0000)
commit9b7992d91b8b119707afd9f8dc4976bb9e209f2e
treec1373a7e35a87c6ea01d7c47cb0d8feddde42f5d
parent236b41e8e4a2b25a4138437935e18ca1895dcae9
Bug 5048: ResolvedPeers.cc:35: "found != paths_.end()" assertion (#680)

This bug was caused by a4d576d. ResolvedPeers::retryPath() used
connection object pointers to find the original path location under the
incorrect assumption that the Connection pointers never change. That
assumption was wrong for persistent connections: ResolvedPeers stores a
half-baked Connection object rather than the corresponding open
Connection object that the unfortunate caller got from fwdPconnPool and
passed to ResolvedPeers::retryPath().

While working on a fix, we discovered a second reason why the pointer
comparison was a bad idea (and why a simpler fix of comparing addresses
rather than pointers was also a bad idea): The peer selection code
promises to deliver unique destinations, but we now suspect that, under
presumably rare circumstances, it may deliver duplicates. This broken
promise is now an out-of-scope XXX in PeerSelector::addSelection().

Squid now eliminates the search (and the previously documented concern
about its slow speed) by remembering Connection's position in the
destination array. The position is remembered in a smart Connection
pointer (compatible with Comm::ConnectionPointer) so that the rest of
the code (that does not really care about all this) is preserved largely
unchanged. Most changes are just renaming the pointer type.

Also freshened a FwdState call and comment made stale by 25b0ce4.

Also marked an out-of-scope problem in maybeGivePrimeItsChance() caller.
13 files changed:
src/FwdState.cc
src/FwdState.h
src/HappyConnOpener.cc
src/HappyConnOpener.h
src/ResolvedPeers.cc
src/ResolvedPeers.h
src/comm/ConnOpener.cc
src/comm/ConnOpener.h
src/comm/Connection.cc
src/comm/Connection.h
src/ident/Ident.cc
src/peer_select.cc
src/tests/stub_libcomm.cc