Re: get_controlfile() can leak fds in the backend - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: get_controlfile() can leak fds in the backend
Date
Msg-id alpine.DEB.2.21.1902280946060.7815@lancre
Whole thread Raw
In response to Re: get_controlfile() can leak fds in the backend  (Andres Freund <andres@anarazel.de>)
Responses Re: get_controlfile() can leak fds in the backend
List pgsql-hackers
Hello Andres,

>> Note that my concern is not about the page size, but rather that as more
>> commands may change the cluster status by editing the control file, it would
>> be better that a postmaster does not start while a pg_rewind or enable
>> checksum or whatever is in progress, and currently there is a possible race
>> condition between the read and write that can induce an issue, at least
>> theoretically.
>
> Seems odd to bring this up in this thread, it really has nothing to do
> with the topic.

Indeed. I raised it here because it is in the same area of code and 
Michaël was looking at it.

> If we were to want to do more here, ISTM the right approach would use 
> the postmaster pid file, not the control file.

ISTM that this just means re-inventing a manual poor-featured 
race-condition-prone lock API around another file, which seems to be 
created more or less only by "pg_ctl", while some other commands use the 
control file (eg pg_rewind, AFAICS).

-- 
Fabien.

pgsql-hackers by date:

Previous
From: "Ideriha, Takeshi"
Date:
Subject: RE: Protect syscache from bloating with negative cache entries
Next
From: Ramanarayana
Date:
Subject: Re: XML/XPath issues: text/CDATA in XMLTABLE, XPath evaluated withwrong context