pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix race condition at backend exit when deleting element in sync 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix race condition at backend exit when deleting element in sync @ 2019-11-01 13:39 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2019-11-01 13:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition at backend exit when deleting element in syncrep queue When a backend exits, it gets deleted from the syncrep queue if present. The queue was checked without SyncRepLock taken in exclusive mode, so it would have been possible for a backend to remove itself after a WAL sender already did the job. Fix this issue based on a suggestion from Fujii Masao, by first checking the queue without the lock. Then, if the backend is present in the queue, take the lock and perform an additional lookup check before doing the element deletion. Author: Dongming Liu Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com Backpatch-through: 9.4 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/20345197ff48c99a8a20dd3cd191d2aad5c7271c Modified Files -------------- src/backend/replication/syncrep.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix race condition at backend exit when deleting element in sync @ 2019-11-01 13:39 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2019-11-01 13:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition at backend exit when deleting element in syncrep queue When a backend exits, it gets deleted from the syncrep queue if present. The queue was checked without SyncRepLock taken in exclusive mode, so it would have been possible for a backend to remove itself after a WAL sender already did the job. Fix this issue based on a suggestion from Fujii Masao, by first checking the queue without the lock. Then, if the backend is present in the queue, take the lock and perform an additional lookup check before doing the element deletion. Author: Dongming Liu Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com Backpatch-through: 9.4 Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7b8c2de64e66659115c1e4075c025d6392d659ef Modified Files -------------- src/backend/replication/syncrep.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix race condition at backend exit when deleting element in sync @ 2019-11-01 13:39 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2019-11-01 13:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition at backend exit when deleting element in syncrep queue When a backend exits, it gets deleted from the syncrep queue if present. The queue was checked without SyncRepLock taken in exclusive mode, so it would have been possible for a backend to remove itself after a WAL sender already did the job. Fix this issue based on a suggestion from Fujii Masao, by first checking the queue without the lock. Then, if the backend is present in the queue, take the lock and perform an additional lookup check before doing the element deletion. Author: Dongming Liu Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com Backpatch-through: 9.4 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/61f23839257d8260664d0af0ff82cc3dd2b46786 Modified Files -------------- src/backend/replication/syncrep.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix race condition at backend exit when deleting element in sync @ 2019-11-01 13:39 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2019-11-01 13:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition at backend exit when deleting element in syncrep queue When a backend exits, it gets deleted from the syncrep queue if present. The queue was checked without SyncRepLock taken in exclusive mode, so it would have been possible for a backend to remove itself after a WAL sender already did the job. Fix this issue based on a suggestion from Fujii Masao, by first checking the queue without the lock. Then, if the backend is present in the queue, take the lock and perform an additional lookup check before doing the element deletion. Author: Dongming Liu Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com Backpatch-through: 9.4 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b99bfc3c96f16c4e08bc1276cee95f01bcc09bf3 Modified Files -------------- src/backend/replication/syncrep.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix race condition at backend exit when deleting element in sync @ 2019-11-01 13:39 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2019-11-01 13:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition at backend exit when deleting element in syncrep queue When a backend exits, it gets deleted from the syncrep queue if present. The queue was checked without SyncRepLock taken in exclusive mode, so it would have been possible for a backend to remove itself after a WAL sender already did the job. Fix this issue based on a suggestion from Fujii Masao, by first checking the queue without the lock. Then, if the backend is present in the queue, take the lock and perform an additional lookup check before doing the element deletion. Author: Dongming Liu Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com Backpatch-through: 9.4 Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/52684bc7d9579fefa69e09797e798dbe2b0acbd2 Modified Files -------------- src/backend/replication/syncrep.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix race condition at backend exit when deleting element in sync @ 2019-11-01 13:39 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2019-11-01 13:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition at backend exit when deleting element in syncrep queue When a backend exits, it gets deleted from the syncrep queue if present. The queue was checked without SyncRepLock taken in exclusive mode, so it would have been possible for a backend to remove itself after a WAL sender already did the job. Fix this issue based on a suggestion from Fujii Masao, by first checking the queue without the lock. Then, if the backend is present in the queue, take the lock and perform an additional lookup check before doing the element deletion. Author: Dongming Liu Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com Backpatch-through: 9.4 Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0927d0c25c567564f1ce24ab9d8d6f1c5d83f1f0 Modified Files -------------- src/backend/replication/syncrep.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix race condition at backend exit when deleting element in sync @ 2019-11-01 13:39 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2019-11-01 13:39 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix race condition at backend exit when deleting element in syncrep queue When a backend exits, it gets deleted from the syncrep queue if present. The queue was checked without SyncRepLock taken in exclusive mode, so it would have been possible for a backend to remove itself after a WAL sender already did the job. Fix this issue based on a suggestion from Fujii Masao, by first checking the queue without the lock. Then, if the backend is present in the queue, take the lock and perform an additional lookup check before doing the element deletion. Author: Dongming Liu Reviewed-by: Kyotaro Horiguchi, Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/a0806273-8bbb-43b3-bbe1-c45a58f6ae21.lingce.ldm@alibaba-inc.com Backpatch-through: 9.4 Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f88f7206edbfe9d06655e3885219d812b0362251 Modified Files -------------- src/backend/replication/syncrep.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2019-11-01 13:39 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-11-01 13:39 pgsql: Fix race condition at backend exit when deleting element in sync Michael Paquier <michael@paquier.xyz> 2019-11-01 13:39 pgsql: Fix race condition at backend exit when deleting element in sync Michael Paquier <michael@paquier.xyz> 2019-11-01 13:39 pgsql: Fix race condition at backend exit when deleting element in sync Michael Paquier <michael@paquier.xyz> 2019-11-01 13:39 pgsql: Fix race condition at backend exit when deleting element in sync Michael Paquier <michael@paquier.xyz> 2019-11-01 13:39 pgsql: Fix race condition at backend exit when deleting element in sync Michael Paquier <michael@paquier.xyz> 2019-11-01 13:39 pgsql: Fix race condition at backend exit when deleting element in sync Michael Paquier <michael@paquier.xyz> 2019-11-01 13:39 pgsql: Fix race condition at backend exit when deleting element in sync Michael Paquier <michael@paquier.xyz>
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