pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: shm_mq: Third attempt at fixing nowait behavior in shm_mq_receiv 3+ messages / 1 participants [nested] [flat]
* pgsql: shm_mq: Third attempt at fixing nowait behavior in shm_mq_receiv @ 2015-11-03 15:00 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Robert Haas @ 2015-11-03 15:00 UTC (permalink / raw) To: 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(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: shm_mq: Third attempt at fixing nowait behavior in shm_mq_receiv @ 2015-11-03 15:00 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Robert Haas @ 2015-11-03 15:00 UTC (permalink / raw) To: 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 ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/fd5ce6b89b63bdb9632a925a80f6f7d4e7bd2e00 Modified Files -------------- src/backend/storage/ipc/shm_mq.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: shm_mq: Third attempt at fixing nowait behavior in shm_mq_receiv @ 2015-11-03 15:00 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Robert Haas @ 2015-11-03 15:00 UTC (permalink / raw) To: 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 ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/038aa89af53ee6ee26dfc9e73704d4e94701588f Modified Files -------------- src/backend/storage/ipc/shm_mq.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2015-11-03 15:00 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-11-03 15:00 pgsql: shm_mq: Third attempt at fixing nowait behavior in shm_mq_receiv Robert Haas <rhaas@postgresql.org> 2015-11-03 15:00 pgsql: shm_mq: Third attempt at fixing nowait behavior in shm_mq_receiv Robert Haas <rhaas@postgresql.org> 2015-11-03 15:00 pgsql: shm_mq: Third attempt at fixing nowait behavior in shm_mq_receiv Robert Haas <rhaas@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox