From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | bianpan2016(at)163(dot)com |
Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: BUG #15105: OpenTransientFile() should be paired with CloseTransientFile() rather than close() |
Date: | 2018-04-10 22:40:43 |
Message-ID: | 12895.1523400043@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I wrote:
> Michael Paquier <michael(at)paquier(dot)xyz> writes:
>> On Fri, Mar 09, 2018 at 03:29:25AM +0000, PG Bug reporting form wrote:
>>> Details: The handler opened with OpenTransientFile() should be closed with
>>> CloseTransientFile(). However, in function dsm_impl_mmap(), on a certain
>>> path, the return value of OpenTransientFile() (at line 885) is passed to
>>> close() (at line 926). It is better to use CloseTransientFile() here, as
>>> done at line 909.
>> Good catch! This is visibly a copy-paste error coming from
>> dsm_impl_posix(). As a patch it gives the attached. I am adding also
>> Robert in CC for awareness.
Now that the commitfest crunch is over, I've checked and pushed this.
> Presumably, this would have been found sooner if AtEOXact_Files acted
> like most other end-of-xact cleanup functions and whined about leaked
> resources (in the commit case). I wonder why it doesn't.
On closer inspection, such a cross-check wouldn't have helped find this
particular mistake, because it was in an error exit path that's likely
never been exercised by anybody, and certainly isn't hit in the regression
tests. Still, I think it'd be a good thing to add, and hence propose the
attached patch. (I've verified that the warning doesn't fire in "make
check-world".)
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
eoxact-files-warning.patch | text/x-diff | 6.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Soni M | 2018-04-10 23:17:41 | pg_dump with disable trigger |
Previous Message | Peter Geoghegan | 2018-04-10 19:55:50 | Re: BUG #15144: *** glibc detected *** postgres: postgres smsconsole [local] SELECT: double free or corruption (!pre |