OpenTemporaryFile() vs resowner.c

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: OpenTemporaryFile() vs resowner.c
Date: 2017-11-08 01:09:22
Message-ID: CAEepm=3y_jxHjXb3SM778rbRAfpXjZOez0skiaDVBxp_9-Wqkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Andres, Robert and Peter G rightly complained[1] that my shared
temporary file patch opens a file, then calls
ResourceOwnerEnlargeFiles() which can fail due to lack of memory, and
then registers the file handle to make sure we don't leak it. Doh.
The whole point of the separate ResourceOwnerEnlargeXXX() interface is
to be able to put it before resource acquisition.

The existing OpenTemporaryFile() coding has the same mistake. Please
see attached.

[1] https://www.postgresql.org/message-id/20171107210155.kuksdd324kgz5oev%40alap3.anarazel.de

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
fix-file-leak.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2017-11-08 01:38:12 Remove duplicate setting in test/recovery/Makefile
Previous Message Michael Paquier 2017-11-08 00:58:45 Re: Exclude pg_internal.init from base backup