
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:
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe