pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix race condition that lead to WALInsertLock deadlock with comm 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix race condition that lead to WALInsertLock deadlock with comm @ 2015-08-02 17:11 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 3+ messages in thread From: Heikki Linnakangas @ 2015-08-02 17:11 UTC (permalink / raw) To: pgsql-committers Fix race condition that lead to WALInsertLock deadlock with commit_delay. If a call to WaitForXLogInsertionsToFinish() returned a value in the middle of a page, and another backend then started to insert a record to the same page, and then you called WaitXLogInsertionsToFinish() again, the second call might return a smaller value than the first call. The problem was in GetXLogBuffer(), which always updated the insertingAt value to the beginning of the requested page, not the actual requested location. Because of that, the second call might return a xlog pointer to the beginning of the page, while the first one returned a later position on the same page. XLogFlush() performs two calls to WaitXLogInsertionsToFinish() in succession, and holds WALWriteLock on the second call, which can deadlock if the second call to WaitXLogInsertionsToFinish() blocks. Reported by Spiros Ioannou. Backpatch to 9.4, where the more scalable WALInsertLock mechanism, and this bug, was introduced. Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/54f23a45f3742e9533dbfa7c1177f02f116b0457 Modified Files -------------- src/backend/access/transam/xlog.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 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: Fix race condition that lead to WALInsertLock deadlock with comm @ 2015-08-02 17:11 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 3+ messages in thread From: Heikki Linnakangas @ 2015-08-02 17:11 UTC (permalink / raw) To: pgsql-committers Fix race condition that lead to WALInsertLock deadlock with commit_delay. If a call to WaitForXLogInsertionsToFinish() returned a value in the middle of a page, and another backend then started to insert a record to the same page, and then you called WaitXLogInsertionsToFinish() again, the second call might return a smaller value than the first call. The problem was in GetXLogBuffer(), which always updated the insertingAt value to the beginning of the requested page, not the actual requested location. Because of that, the second call might return a xlog pointer to the beginning of the page, while the first one returned a later position on the same page. XLogFlush() performs two calls to WaitXLogInsertionsToFinish() in succession, and holds WALWriteLock on the second call, which can deadlock if the second call to WaitXLogInsertionsToFinish() blocks. Reported by Spiros Ioannou. Backpatch to 9.4, where the more scalable WALInsertLock mechanism, and this bug, was introduced. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/358cde320b17535011b0a912e5c9ce1453666ed1 Modified Files -------------- src/backend/access/transam/xlog.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 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: Fix race condition that lead to WALInsertLock deadlock with comm @ 2015-08-02 17:11 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 3+ messages in thread From: Heikki Linnakangas @ 2015-08-02 17:11 UTC (permalink / raw) To: pgsql-committers Fix race condition that lead to WALInsertLock deadlock with commit_delay. If a call to WaitForXLogInsertionsToFinish() returned a value in the middle of a page, and another backend then started to insert a record to the same page, and then you called WaitXLogInsertionsToFinish() again, the second call might return a smaller value than the first call. The problem was in GetXLogBuffer(), which always updated the insertingAt value to the beginning of the requested page, not the actual requested location. Because of that, the second call might return a xlog pointer to the beginning of the page, while the first one returned a later position on the same page. XLogFlush() performs two calls to WaitXLogInsertionsToFinish() in succession, and holds WALWriteLock on the second call, which can deadlock if the second call to WaitXLogInsertionsToFinish() blocks. Reported by Spiros Ioannou. Backpatch to 9.4, where the more scalable WALInsertLock mechanism, and this bug, was introduced. Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/bab959906911c97437f410a03b0346e6dd28d528 Modified Files -------------- src/backend/access/transam/xlog.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 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-08-02 17:11 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-08-02 17:11 pgsql: Fix race condition that lead to WALInsertLock deadlock with comm Heikki Linnakangas <heikki.linnakangas@iki.fi> 2015-08-02 17:11 pgsql: Fix race condition that lead to WALInsertLock deadlock with comm Heikki Linnakangas <heikki.linnakangas@iki.fi> 2015-08-02 17:11 pgsql: Fix race condition that lead to WALInsertLock deadlock with comm Heikki Linnakangas <heikki.linnakangas@iki.fi>
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