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

Bardur Arantsson spam at scientician.net
Wed Feb 10 14:15:23 EST 2010

Jeremy Shaw wrote:
> On Feb 9, 2010, at 6:47 PM, Thomas Hartman wrote:
>> Matt, have you seen this thread?
>> Jeremy, are you saying this a bug in the sendfile library on hackage,
>> or something underlying?
> I'm saying that the behavior of the sendfile library is buggy. But it 
> could be due to something underlying..
> Either threadWaitWrite is buggy and should be fixed. Or threadWaitWrite 
> is doing the right thing, and sendfile needs to be modified some how to 
> account for the behavior. But I don't know which is the case or how to 
> implement a solution to either option.

IMO, in the interests of "correctness over speed", an interim release of 
sendfile which simply uses the "portable" code on Linux should be put 
out. The CPU overhead of the "portable" method doesn't matter that much 
for servers which aren't extremely busy.

I've also been contemplating some solutions, but I cannot see any 
solutions to this problem which could reasonably be implemented outside 
of GHC itself. GHC lacks a "threadWaitError", so there's no way to 
detect the problem except by timeout or polling. Solutions involving 
timeouts and polling are bad in this case because they arbitrarily 
restrict the client connection rate.


More information about the Haskell-Cafe mailing list