pgsql: Make get_controlfile not leak file descriptors

Поиск
Список
Период
Сортировка
От Joe Conway
Тема pgsql: Make get_controlfile not leak file descriptors
Дата
Msg-id E1gzSlW-0002Bf-6v@gemulon.postgresql.org
обсуждение исходный текст
Список 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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Use slots in trigger infrastructure, except for theactual invoc
Следующее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Improve docs for ALTER TABLE .. SET TABLESPACE