pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix error handling in libpqrcv_connect() 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix error handling in libpqrcv_connect() @ 2023-01-24 02:51 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2023-01-24 02:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix error handling in libpqrcv_connect() When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked the libpq connection. In most paths that's fairly harmless, as the calling process will exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhat longer lived leak. Fix by releasing resources, including the libpq connection, on error. Add a test exercising the error code path. To make it reliable and safe, the test tries to connect to port=-1, which happens to fail during connection establishment, rather than during connection string parsing. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20230121011237.q52apbvlarfv6jm6@awork3.anarazel.de Backpatch: 11- Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/bc54ef4ec25a3c642f1706a49f979b7750a2817e Modified Files -------------- .../libpqwalreceiver/libpqwalreceiver.c | 26 +++++++++++++--------- src/test/regress/expected/subscription.out | 10 ++++++++- src/test/regress/sql/subscription.sql | 9 +++++++- 3 files changed, 32 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix error handling in libpqrcv_connect() @ 2023-01-24 02:51 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2023-01-24 02:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix error handling in libpqrcv_connect() When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked the libpq connection. In most paths that's fairly harmless, as the calling process will exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhat longer lived leak. Fix by releasing resources, including the libpq connection, on error. Add a test exercising the error code path. To make it reliable and safe, the test tries to connect to port=-1, which happens to fail during connection establishment, rather than during connection string parsing. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20230121011237.q52apbvlarfv6jm6@awork3.anarazel.de Backpatch: 11- Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/704a330a9ee882bebbe4abe44c9f174ceaaf2f69 Modified Files -------------- .../libpqwalreceiver/libpqwalreceiver.c | 26 +++++++++++++--------- src/test/regress/expected/subscription.out | 10 ++++++++- src/test/regress/sql/subscription.sql | 9 +++++++- 3 files changed, 32 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix error handling in libpqrcv_connect() @ 2023-01-24 02:51 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2023-01-24 02:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix error handling in libpqrcv_connect() When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked the libpq connection. In most paths that's fairly harmless, as the calling process will exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhat longer lived leak. Fix by releasing resources, including the libpq connection, on error. Add a test exercising the error code path. To make it reliable and safe, the test tries to connect to port=-1, which happens to fail during connection establishment, rather than during connection string parsing. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20230121011237.q52apbvlarfv6jm6@awork3.anarazel.de Backpatch: 11- Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0a796b8b3e311ea21cf679bf71f39b42e859a686 Modified Files -------------- .../libpqwalreceiver/libpqwalreceiver.c | 26 +++++++++++++--------- src/test/regress/expected/subscription.out | 10 ++++++++- src/test/regress/sql/subscription.sql | 9 +++++++- 3 files changed, 32 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix error handling in libpqrcv_connect() @ 2023-01-24 02:51 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2023-01-24 02:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix error handling in libpqrcv_connect() When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked the libpq connection. In most paths that's fairly harmless, as the calling process will exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhat longer lived leak. Fix by releasing resources, including the libpq connection, on error. Add a test exercising the error code path. To make it reliable and safe, the test tries to connect to port=-1, which happens to fail during connection establishment, rather than during connection string parsing. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20230121011237.q52apbvlarfv6jm6@awork3.anarazel.de Backpatch: 11- Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c5864805ba99f79b49b12dc14499da58b0e15eb8 Modified Files -------------- .../libpqwalreceiver/libpqwalreceiver.c | 26 +++++++++++++--------- src/test/regress/expected/subscription.out | 10 ++++++++- src/test/regress/sql/subscription.sql | 9 +++++++- 3 files changed, 32 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix error handling in libpqrcv_connect() @ 2023-01-24 02:51 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2023-01-24 02:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix error handling in libpqrcv_connect() When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked the libpq connection. In most paths that's fairly harmless, as the calling process will exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhat longer lived leak. Fix by releasing resources, including the libpq connection, on error. Add a test exercising the error code path. To make it reliable and safe, the test tries to connect to port=-1, which happens to fail during connection establishment, rather than during connection string parsing. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20230121011237.q52apbvlarfv6jm6@awork3.anarazel.de Backpatch: 11- Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/92fc1278786f3b135da19d11538e9d9b30f4b04a Modified Files -------------- .../libpqwalreceiver/libpqwalreceiver.c | 26 +++++++++++++--------- src/test/regress/expected/subscription.out | 10 ++++++++- src/test/regress/sql/subscription.sql | 9 +++++++- 3 files changed, 32 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix error handling in libpqrcv_connect() @ 2023-01-24 02:51 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2023-01-24 02:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix error handling in libpqrcv_connect() When libpqrcv_connect (also known as walrcv_connect()) failed, it leaked the libpq connection. In most paths that's fairly harmless, as the calling process will exit soon after. But e.g. CREATE SUBSCRIPTION could lead to a somewhat longer lived leak. Fix by releasing resources, including the libpq connection, on error. Add a test exercising the error code path. To make it reliable and safe, the test tries to connect to port=-1, which happens to fail during connection establishment, rather than during connection string parsing. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20230121011237.q52apbvlarfv6jm6@awork3.anarazel.de Backpatch: 11- Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/243373159fb427dfb6fcf43e2ac403d9d3b82752 Modified Files -------------- .../libpqwalreceiver/libpqwalreceiver.c | 26 +++++++++++++--------- src/test/regress/expected/subscription.out | 10 ++++++++- src/test/regress/sql/subscription.sql | 9 +++++++- 3 files changed, 32 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2023-01-24 02:51 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-01-24 02:51 pgsql: Fix error handling in libpqrcv_connect() Andres Freund <andres@anarazel.de> 2023-01-24 02:51 pgsql: Fix error handling in libpqrcv_connect() Andres Freund <andres@anarazel.de> 2023-01-24 02:51 pgsql: Fix error handling in libpqrcv_connect() Andres Freund <andres@anarazel.de> 2023-01-24 02:51 pgsql: Fix error handling in libpqrcv_connect() Andres Freund <andres@anarazel.de> 2023-01-24 02:51 pgsql: Fix error handling in libpqrcv_connect() Andres Freund <andres@anarazel.de> 2023-01-24 02:51 pgsql: Fix error handling in libpqrcv_connect() Andres Freund <andres@anarazel.de>
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