squid icon indicating copy to clipboard operation
squid copied to clipboard

Fix PeerDigest lifetime management

Open eduard-bagdasaryan opened this issue 1 week ago • 0 comments

This change fixes how cbdata is used for managing CachePeer::digest lifetime. Prior to these changes, cbdata was (ab)used as a reference counting mechanism: CachePeer::digest object could outlive CachePeer (effectively its creator), necessitating complex "is it time to delete this digest?" cleanup logic. Now, CachePeer is an exclusive digest owner that no longer locks/unlocks its digest field; it just creates/deletes the object. Digest fetching code no longer needs to cleanup the digest.

"CachePeer::digest is always valid" invariant simplifies digest fetching code and, hopefully, reduces the probability of bugs similar to Bug 5329 fixed in minimal commit 4657405 (that promised this refactoring).

eduard-bagdasaryan avatar Jul 01 '24 12:07 eduard-bagdasaryan