]> git.ipfire.org Git - thirdparty/squid.git/commit
Ignore SMP queue responses made stale by worker restarts (#711)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Wed, 12 Aug 2020 22:47:14 +0000 (22:47 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 13 Aug 2020 11:39:17 +0000 (11:39 +0000)
commit30fe12bc8814768d8978c9c84771b08750c7f2fe
treecbee3ac3eabe6d677a159174b3376f99762292f5
parent18ce34b290020c79943bcdaba5debcce568e57f0
Ignore SMP queue responses made stale by worker restarts (#711)

When a worker restarts (for any reason), the disker-to-worker queue may
contain disker responses to I/O requests sent by the previous
incarnation of the restarted worker process (the "previous generation"
responses). Since the current response:request mapping mechanism relies
on a 32-bit integer counter, and a worker process always starts counting
from 0, there is a small chance that the restarted worker may see a
previous generation response that accidentally matches the current
generation request ID.

For writing transactions, accepting a previous generation response may
mean unlocking a cache entry too soon, making not yet written slots
available to other workers that might read wrong content. For reading
transactions, accepting a previous generation response may mean
immediately serving wrong response content (that have been already
overwritten on disk with the information that the restarted worker is
now waiting for).

To avoid these problems, each disk I/O request now stores the worker
process ID. Workers ignore responses to requests originated by a
different/mismatching worker ID.
src/DiskIO/IpcIo/IpcIoFile.cc
src/DiskIO/IpcIo/IpcIoFile.h