]> git.ipfire.org Git - thirdparty/squid.git/commit
Fixed ipc/Queue notification race leading to stuck, overflowing queues.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 21 Jun 2013 00:50:35 +0000 (18:50 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 21 Jun 2013 00:50:35 +0000 (18:50 -0600)
commitad40da437bb8429db775e34bbfa861b9ed501da4
treebde28d89327f70175ce0b3657a1e20cf075e8e6e
parent55759ffbbd3e87ef532266db000bbaebc8388435
Fixed ipc/Queue notification race leading to stuck, overflowing queues.

The writer calling OneToOneUniQueue::push() must tell readers if it places the
first item into a previously empty queue. We used to determine emptiness prior
to incrementing queue size. That created a window between wasEmpty calculation
and queuing the new item (by incrementing the queue size). During that window,
the readers could pop() all previously queued items (resulting in an empty
queue) but since that happened after wasEmpty was computed to be false, the
writer would not notify them about the new item it just placed, and they will
get stuck, eventually resulting in queue overflow errors.

The fix attempts to increment the queue size and extract the previous size
value atomically.
src/ipc/Queue.h