Project

General

Profile

Actions

Bug #3540

closed

IO.copy_stream fails to detect client disconnect w/sendfile

Added by normalperson (Eric Wong) almost 14 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2010-07-04 trunk 28540) [x86_64-linux]
Backport:
[ruby-core:31053]

Description

=begin
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)
    =end

Files

sendfile-retry.patch (369 Bytes) sendfile-retry.patch patch to force a retry immediately to detect error normalperson (Eric Wong), 07/06/2010 05:12 AM
wait_write.rb (548 Bytes) wait_write.rb script to reproduce the issue without patch under Linux normalperson (Eric Wong), 07/06/2010 05:12 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0