From: | Robert Haas <rhaas(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: shm_mq: Third attempt at fixing nowait behavior in shm_mq_receiv |
Date: | 2015-11-03 15:00:01 |
Message-ID: | E1Ztd45-0006gn-Qt@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
shm_mq: Third attempt at fixing nowait behavior in shm_mq_receive.
Commit a1480ec1d3bacb9acb08ec09f22bc25bc033115b purported to fix the
problems with commit b2ccb5f4e6c81305386edb34daf7d1d1e1ee112a, but it
didn't completely fix them. The problem is that the checks were
performed in the wrong order, leading to a race condition. If the
sender attached, sent a message, and detached after the receiver
called shm_mq_get_sender and before the receiver called
shm_mq_counterparty_gone, we'd incorrectly return SHM_MQ_DETACHED
before all messages were read. Repair by reversing the order of
operations, and add a long comment explaining why this new logic is
(hopefully) correct.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/4efe26cbd3ef0d85656bf00ac9e5bd41cc8a2a36
Modified Files
--------------
src/backend/storage/ipc/shm_mq.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-11-03 16:49:31 | pgsql: Code + docs review for unicode linestyle patch. |
Previous Message | Robert Haas | 2015-11-03 13:47:48 | pgsql: Correct tiny inaccuracy in strxfrm cache comment. |