[Haskell-cafe] Preventing leaked open file descriptors whencatching exceptions

Ryan Newton rrnewton at gmail.com
Tue Feb 21 19:29:03 CET 2012

Ah, thanks Bryan.  I hadn't looked into it enough to realize that FDs are
just ints and not ForeignPtrs w/ finalizers.

Re: Donn's point.  Well, yes, that would seem to be the case!  But since I
think a linux bug is unlikely, I'm afraid that there's something else going
on here which I am not thinking of.

I'll make a self contained test of this and send it out.

On Tue, Feb 21, 2012 at 12:53 PM, Donn Cave <donn at avvanta.com> wrote:

> Quoth "Bryan O'Sullivan" <bos at serpentine.com>,
> > On Tue, Feb 21, 2012 at 8:16 AM, Ryan Newton <rrnewton at gmail.com> wrote:
> >
> >> FYI, lsof confirms that there are indeed many many open connections to
> the
> >> same FIFO:
> >>
> >
> > Like all of the lowest-level I/O functions, openFD just gives you back an
> > integer, and the Fd type has no notion that there's an underlying system
> > resource associated with it. It's your responsibility to manage it (i.e.
> > clean up manually when catching an exception).
> What's more - if I understood the hypothesis correctly, that the
> exception occurs during openFd - that fails to return an Fd because
> the open(2) system call fails to return one, so it would presumably
> be an OS level bug if there's really an open file descriptor left
> from this.
>        Donn
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120221/c9d16955/attachment.htm>

More information about the Haskell-Cafe mailing list