From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Make get_controlfile not leak file descriptors |
Date: | 2019-02-28 20:58:50 |
Message-ID: | E1gzSlW-0002Bf-6v@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Make get_controlfile not leak file descriptors
When backend functions were added to expose controldata via SQL,
reading of pg_control was consolidated under src/common so that
both frontend and backend could share the same code. That move
from frontend-only to shared frontend-backend failed to recognize
the risk (and coding standards violation) of using a bare open().
In particular, it risked leaking file descriptors if transient
errors occurred while reading the file. Fix that by using
OpenTransientFile() instead in the backend case, which is
purpose-built for this type of usage.
Since there have been no complaints from the field, and an intermittent
failure low risk, no backpatch. Hard failure would of course be bad, but
in that case these functions are probably the least of your worries.
Author: Joe Conway
Reviewed-By: Michael Paquier
Reported by: Michael Paquier
Discussion: https://postgr.es/m/20190227074728.GA15710@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/4598a99cf22de0dbab975d9c87ce16fd53146aca
Modified Files
--------------
src/common/controldata_utils.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-02-28 22:25:23 | pgsql: Improve docs for ALTER TABLE .. SET TABLESPACE |
Previous Message | Andres Freund | 2019-02-28 20:41:38 | Re: pgsql: Use slots in trigger infrastructure, except for the actual invoc |