Bug #3540: IO.copy_stream fails to detect client disconnect w/sendfile
http://redmine.ruby-lang.org/issues/show/3540

Author: Eric Wong
Status: Open, Priority: Normal
Category: core, Target version: 1.9.x
ruby -v: ruby 1.9.3dev (2010-07-04 trunk 28540) [x86_64-linux]

sendfile() may return with a short write upon a client disconnect.  Instead of
retrying and getting an error, Ruby tries to force a select() on the descriptor
which fails to detect the disconnect.  This causes IO.copy_stream to hang,
(possibly until TCP keepalives kick in).  IO.copy_stream should raise
immediately.

Attached are:
* a patch to fix the issue
* a script that reproduces the issue with sendfile (under Linux 2.6.34)


----------------------------------------
http://redmine.ruby-lang.org