]> git.ipfire.org Git - thirdparty/squid.git/commit
Improve detection of lonely StoreEntry clients (#1312)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 25 Mar 2023 03:40:27 +0000 (03:40 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 25 Mar 2023 20:15:05 +0000 (20:15 +0000)
commitd2000809ffc2bf30545470eb2a91c92c161aa8cb
tree323301dd811d1863044db11e77d83a4a8f9f06df
parent682b7fcd1a80df0ebfaca7c410e4210cdb7d059e
Improve detection of lonely StoreEntry clients (#1312)

The first storeClientType() call still sees zero nclients because
storeClientListAdd() creates a store_client object (which triggers
storeClientType()) first and only then adds it to the list of clients
(which increases nclients). This off-by-one bug was introduced in commit
528b2c6 that reordered nclients increase and the storeClientType() call.

The bug could lead to excessive disk I/O in some environments because
Squid could see more STORE_DISK_CLIENT store_client objects, and those
may trigger startSwapin() in store_client::doCopy(). However, the exact
effects of this bug/fix are difficult to predict because startSwapin()
may be separated by async calls and is guarded by additional conditions.

A full fix requires refactoring the caller, but there are so many
problems associated with storeClientType() and startSwapin() calls that
such refactoring deserves a dedicated effort.

Technically, this "first" client may be 10th client this StoreEntry has
seen, but it is the first one among the _current_ entry clients.
src/store.cc