Excerpts from Bardur Arantsson's message of Tue Feb 16 23:48:14 +0200 2010:
> > This cannot be fixed in the sendfile library, it is a 
> > feature of TCP that connections may linger for a long
> > time unless explicit timeouts are used.
> 
> The problem is that the sendfile library *doesn't* wake
> up when the connection is terminated (because of threadWaitWrite)
> -- it doesn't matter what the timeout is.

Even server code without sendfile has the same issue since
all writing to sockets ends up using threadWaitWrite.

System.Timeout.timeout terminates a threadWaitWrite using
asynchronous exceptions.

If you want to detect dead sockets somewhat reliably 
without a timeout then there is SO_KEEPALIVE combined
with polling SO_ERROR every few minutes.

- Taru Karttunen
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to