pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: postgres_fdw: Fix connection leak. 7+ messages / 1 participants [nested] [flat]
* pgsql: postgres_fdw: Fix connection leak. @ 2020-12-28 11:02 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2020-12-28 11:02 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix connection leak. In postgres_fdw, the cached connections to foreign servers will not be closed until the local session exits if the user mappings or foreign servers that those connections depend on are dropped. Those connections can be leaked. To fix that connection leak issue, after a change to a pg_foreign_server or pg_user_mapping catalog entry, this commit makes postgres_fdw close the connections depending on that entry immediately if current transaction has not used those connections yet. Otherwise, mark those connections as invalid and then close them at the end of current transaction, since they cannot be closed in the midst of the transaction using them. Closed connections will be remade at the next opportunity if necessary. Back-patch to all supported branches. Author: Bharath Rupireddy Reviewed-by: Zhihong Yu, Zhijie Hou, Fujii Masao Discussion: https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b5c73eef8adf5e722564c7e512de761b1a08bfe2 Modified Files -------------- contrib/postgres_fdw/connection.c | 33 ++++++++++++++++++++------ contrib/postgres_fdw/expected/postgres_fdw.out | 18 ++++++++++++++ contrib/postgres_fdw/sql/postgres_fdw.sql | 14 +++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: postgres_fdw: Fix connection leak. @ 2020-12-28 11:02 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2020-12-28 11:02 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix connection leak. In postgres_fdw, the cached connections to foreign servers will not be closed until the local session exits if the user mappings or foreign servers that those connections depend on are dropped. Those connections can be leaked. To fix that connection leak issue, after a change to a pg_foreign_server or pg_user_mapping catalog entry, this commit makes postgres_fdw close the connections depending on that entry immediately if current transaction has not used those connections yet. Otherwise, mark those connections as invalid and then close them at the end of current transaction, since they cannot be closed in the midst of the transaction using them. Closed connections will be remade at the next opportunity if necessary. Back-patch to all supported branches. Author: Bharath Rupireddy Reviewed-by: Zhihong Yu, Zhijie Hou, Fujii Masao Discussion: https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/03b7a1ee7b7ff037156c2357eaf545e515ad6455 Modified Files -------------- contrib/postgres_fdw/connection.c | 33 ++++++++++++++++++++------ contrib/postgres_fdw/expected/postgres_fdw.out | 18 ++++++++++++++ contrib/postgres_fdw/sql/postgres_fdw.sql | 14 +++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: postgres_fdw: Fix connection leak. @ 2020-12-28 11:03 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2020-12-28 11:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix connection leak. In postgres_fdw, the cached connections to foreign servers will not be closed until the local session exits if the user mappings or foreign servers that those connections depend on are dropped. Those connections can be leaked. To fix that connection leak issue, after a change to a pg_foreign_server or pg_user_mapping catalog entry, this commit makes postgres_fdw close the connections depending on that entry immediately if current transaction has not used those connections yet. Otherwise, mark those connections as invalid and then close them at the end of current transaction, since they cannot be closed in the midst of the transaction using them. Closed connections will be remade at the next opportunity if necessary. Back-patch to all supported branches. Author: Bharath Rupireddy Reviewed-by: Zhihong Yu, Zhijie Hou, Fujii Masao Discussion: https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/744357d8461c2760260e599549db96ad078b2a01 Modified Files -------------- contrib/postgres_fdw/connection.c | 33 ++++++++++++++++++++------ contrib/postgres_fdw/expected/postgres_fdw.out | 18 ++++++++++++++ contrib/postgres_fdw/sql/postgres_fdw.sql | 14 +++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: postgres_fdw: Fix connection leak. @ 2020-12-28 11:03 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2020-12-28 11:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix connection leak. In postgres_fdw, the cached connections to foreign servers will not be closed until the local session exits if the user mappings or foreign servers that those connections depend on are dropped. Those connections can be leaked. To fix that connection leak issue, after a change to a pg_foreign_server or pg_user_mapping catalog entry, this commit makes postgres_fdw close the connections depending on that entry immediately if current transaction has not used those connections yet. Otherwise, mark those connections as invalid and then close them at the end of current transaction, since they cannot be closed in the midst of the transaction using them. Closed connections will be remade at the next opportunity if necessary. Back-patch to all supported branches. Author: Bharath Rupireddy Reviewed-by: Zhihong Yu, Zhijie Hou, Fujii Masao Discussion: https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/294cdd7d0fffbaadf0f35202a30aab2863e6106a Modified Files -------------- contrib/postgres_fdw/connection.c | 33 ++++++++++++++++++++------ contrib/postgres_fdw/expected/postgres_fdw.out | 18 ++++++++++++++ contrib/postgres_fdw/sql/postgres_fdw.sql | 14 +++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: postgres_fdw: Fix connection leak. @ 2020-12-28 11:03 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2020-12-28 11:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix connection leak. In postgres_fdw, the cached connections to foreign servers will not be closed until the local session exits if the user mappings or foreign servers that those connections depend on are dropped. Those connections can be leaked. To fix that connection leak issue, after a change to a pg_foreign_server or pg_user_mapping catalog entry, this commit makes postgres_fdw close the connections depending on that entry immediately if current transaction has not used those connections yet. Otherwise, mark those connections as invalid and then close them at the end of current transaction, since they cannot be closed in the midst of the transaction using them. Closed connections will be remade at the next opportunity if necessary. Back-patch to all supported branches. Author: Bharath Rupireddy Reviewed-by: Zhihong Yu, Zhijie Hou, Fujii Masao Discussion: https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e792ca4aca2688a7084f739248d34e4f7a812b87 Modified Files -------------- contrib/postgres_fdw/connection.c | 33 ++++++++++++++++++++------ contrib/postgres_fdw/expected/postgres_fdw.out | 18 ++++++++++++++ contrib/postgres_fdw/sql/postgres_fdw.sql | 14 +++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: postgres_fdw: Fix connection leak. @ 2020-12-28 11:04 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2020-12-28 11:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix connection leak. In postgres_fdw, the cached connections to foreign servers will not be closed until the local session exits if the user mappings or foreign servers that those connections depend on are dropped. Those connections can be leaked. To fix that connection leak issue, after a change to a pg_foreign_server or pg_user_mapping catalog entry, this commit makes postgres_fdw close the connections depending on that entry immediately if current transaction has not used those connections yet. Otherwise, mark those connections as invalid and then close them at the end of current transaction, since they cannot be closed in the midst of the transaction using them. Closed connections will be remade at the next opportunity if necessary. Back-patch to all supported branches. Author: Bharath Rupireddy Reviewed-by: Zhihong Yu, Zhijie Hou, Fujii Masao Discussion: https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/546f143740a07c4d9798f5870af8dad73ae057b5 Modified Files -------------- contrib/postgres_fdw/connection.c | 33 ++++++++++++++++++++------ contrib/postgres_fdw/expected/postgres_fdw.out | 18 ++++++++++++++ contrib/postgres_fdw/sql/postgres_fdw.sql | 14 +++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: postgres_fdw: Fix connection leak. @ 2020-12-28 11:04 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: Fujii Masao @ 2020-12-28 11:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org postgres_fdw: Fix connection leak. In postgres_fdw, the cached connections to foreign servers will not be closed until the local session exits if the user mappings or foreign servers that those connections depend on are dropped. Those connections can be leaked. To fix that connection leak issue, after a change to a pg_foreign_server or pg_user_mapping catalog entry, this commit makes postgres_fdw close the connections depending on that entry immediately if current transaction has not used those connections yet. Otherwise, mark those connections as invalid and then close them at the end of current transaction, since they cannot be closed in the midst of the transaction using them. Closed connections will be remade at the next opportunity if necessary. Back-patch to all supported branches. Author: Bharath Rupireddy Reviewed-by: Zhihong Yu, Zhijie Hou, Fujii Masao Discussion: https://postgr.es/m/CALj2ACVNcGH_6qLY-4_tXz8JLvA+4yeBThRfxMz7Oxbk1aHcpQ@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/e3ebcca843a4703938b9f40a4811f43c4b315753 Modified Files -------------- contrib/postgres_fdw/connection.c | 33 ++++++++++++++++++++------ contrib/postgres_fdw/expected/postgres_fdw.out | 18 ++++++++++++++ contrib/postgres_fdw/sql/postgres_fdw.sql | 14 +++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2020-12-28 11:04 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-12-28 11:02 pgsql: postgres_fdw: Fix connection leak. Fujii Masao <fujii@postgresql.org> 2020-12-28 11:02 pgsql: postgres_fdw: Fix connection leak. Fujii Masao <fujii@postgresql.org> 2020-12-28 11:03 pgsql: postgres_fdw: Fix connection leak. Fujii Masao <fujii@postgresql.org> 2020-12-28 11:03 pgsql: postgres_fdw: Fix connection leak. Fujii Masao <fujii@postgresql.org> 2020-12-28 11:03 pgsql: postgres_fdw: Fix connection leak. Fujii Masao <fujii@postgresql.org> 2020-12-28 11:04 pgsql: postgres_fdw: Fix connection leak. Fujii Masao <fujii@postgresql.org> 2020-12-28 11:04 pgsql: postgres_fdw: Fix connection leak. Fujii Masao <fujii@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