[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

Thomas Hartman tphyahoo at gmail.com
Sat Feb 6 16:00:48 EST 2010


me too.

2010/2/5 MightyByte <mightybyte at gmail.com>:
> I've been seeing a steady stream of similar resource vanished messages
> for as long as I've been running my happstack app.  This message I get
> is this:
>
> <socket: 58>: hClose: resource vanished (Broken pipe)
>
> I run my app from a shell script inside a "while true" loop, so it
> automatically gets restarted if it crashes.  This incurs no more than
> a few seconds of down time.  Since that is acceptable for my
> application, I've never put much effort into investigating the issue.
> But I don't think the resource vanished error results in program
> termination.  When I have looked into it, I've had similar trouble
> reproducing it.  Clients such as wget and firefox don't seem to cause
> the problem.  If I remember correctly it only happens with IE.
>
> On Fri, Feb 5, 2010 at 2:56 AM, Bardur Arantsson <spam at scientician.net> wrote:
>> Jeremy Shaw wrote:
>>>
>>> Actually,
>>>
>>> We should start by testing if native sendfile leaks file descriptors even
>>> when the whole file is sent. We have a test suite, but I am not sure if it
>>> tests for file handle leaking...
>>>
>>
>> I should have posted this earlier, but the exact message I'm seeing in the
>> case where the Bad Client disconnects is this:
>>
>>   hums: Network.Socket.SendFile.Linux: resource vanished (Broken pipe)
>>
>> Oddly, I haven't been able to reproduce this using a wget client with a ^C
>> during transfer. When I "disconnect" wget with ^C or "pkill wget" or even
>> "pkill -9 wget", I get this message:
>>
>>  hums: Network.Socket.SendFile.Linux: resource vanished (Connection reset by
>> peer)
>>
>> (and no leak, as observed by "lsof | grep hums").
>>
>> So there appears to be some vital difference between the handling of the two
>> cases.
>>
>> Another observation which may be useful:
>>
>> Before the sendfile' API change (Handle -> FilePath) in sendfile-0.6.x, my
>> code used "withFile" to open the file and to ensure that it was closed. So
>> it seems that withBinaryFile *should* also be fine. Unless the "Broken pipe"
>> error somehow escapes the scope without causing a "close".
>>
>> I don't have time to dig more right now, but I'll try to see if I can find
>> out more later.
>>
>> Cheers,
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list