Re: Testing the return value of fclose() in the backend - Mailing list pgsql-hackers

From Gavin Sherry
Subject Re: Testing the return value of fclose() in the backend
Date
Msg-id Pine.LNX.4.21.0305311300230.13303-100000@linuxworld.com.au
Whole thread Raw
In response to Re: Testing the return value of fclose() in the backend  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
On Fri, 30 May 2003, Bruce Momjian wrote:

> Gavin Sherry wrote:
> > Hi all,
> > 
> > There are various places in the backend, such as FreeFile(), where the
> > return value of fclose() is not tested. Whilst we would often notice any
> > problems with writing to data files due to testing on fsync(), it could
> > affect things like COPY ... TO, CreateOptsFile() and more.
> > 
> > Are we catching these somewhere else I'm not seeing?
> 
> We are not checking fclose, probably because fclose failures are quite
> rare.  Should we be concerned?

fsync() errors are probably just as rare. The problem with long running
daemons not testing for fclose() failure is the problem caused by file
descriptor leakage. I recall that squid (another long running daemon) had
this problem due to the large number of file systems interactions they
undertake. The question is, of course, what to do in postgres if
fclose() returns an error? elog(WARNING)? Another fclose() call? Not sure
what squid did.

Gavin



pgsql-hackers by date:

Previous
From: Christopher Browne
Date:
Subject: Compressing Fields?
Next
From: Bruce Momjian
Date:
Subject: Re: Compressing Fields?