pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Dave Vitek <dvitek@grammatech.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Re: Fwd: race in pg_ctl start -w
Date: Thu, 18 Oct 2012 22:36:50 +0300
Message-ID: <50805A52.6050009@vmware.com> (raw)
In-Reply-To: <20121018191529.GM3763@alvh.no-ip.org>
References: <5076F626.2090404@grammatech.com>
	<5076FF23.6020704@iki.fi>
	<22107.1349976592@sss.pgh.pa.us>
	<50771713.8000908@vmware.com>
	<25454.1349984162@sss.pgh.pa.us>
	<507BC402.40807@vmware.com>
	<508052F6.20803@grammatech.com>
	<20121018191529.GM3763@alvh.no-ip.org>

On 18.10.2012 22:15, Alvaro Herrera wrote:
> Dave Vitek wrote:
>
>> Heikki,
>>
>> It's happy about the overruns.  It did flag an issue where the file
>> descriptor can leak when the various early returns get taken.
>
> This is a common problem with static analysers; they don't realise we
> don't care about the leaked resource because the program is shortly
> going to terminate anyway.  We (used to?) have plenty of false positives
> in initdb as reported in the Coverity scanner, for example.

Actually, this was a real leak. I should've put close() calls to the 
cases where the file is empty, or fstat() fails. It doesn't matter when 
the function is called only once, but in the "pg_ctl start -w" case it's 
called repeatedly to poll for postmaster startup.

Fixed, and I also changed it to not return the last line if it doesn't 
end in a newline, per Tom's suggestion.

- Heikki




view thread (8+ messages)

Message-ID: <50805A52.6050009@vmware.com>
Permalink:  ../50805A52.6050009@vmware.com/
Also on:    postgresql.org/message-id/50805A52.6050009@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hlinnakangas@vmware.com, alvherre@2ndquadrant.com, dvitek@grammatech.com, tgl@sss.pgh.pa.us
  Subject: Re: Fwd: race in pg_ctl start -w
  In-Reply-To: <50805A52.6050009@vmware.com>
  References: <5076F626.2090404@grammatech.com> <5076FF23.6020704@iki.fi> <22107.1349976592@sss.pgh.pa.us> <50771713.8000908@vmware.com> <25454.1349984162@sss.pgh.pa.us> <507BC402.40807@vmware.com> <508052F6.20803@grammatech.com> <20121018191529.GM3763@alvh.no-ip.org> <50805A52.6050009@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox