Project

General

Profile

Actions

Bug #3543

closed

GNU/Linux select hang on a socket which TCP state is CLOSED

Added by akr (Akira Tanaka) about 11 years ago. Updated almost 6 years ago.

Status:
Third Party's Issue
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
-
Backport:
[ruby-dev:41833]

Description

GNU/Linux で、以下のプログラムがハングします。

% uname -mrsv
Linux 2.6.26-2-486 #1 Sat Dec 26 08:37:39 UTC 2009 i686
% ./ruby -rsocket -ve '
BasicSocket.do_not_reverse_lookup = true
serv = TCPServer.open("127.0.0.1", 0)
s1 = TCPSocket.open("127.0.0.1", serv.addr[1])
s2 = serv.accept
s2.close
s1.write("a") rescue p $!
s1.write("a") rescue p $!
Thread.new {
s1.write("a")
}.join'
ruby 1.9.3dev (2010-07-06 trunk 28554) [i686-linux]
#
ここでハング

FreeBSD ではハングしません。

% ./ruby -rsocket -ve '
BasicSocket.do_not_reverse_lookup = true
serv = TCPServer.open("127.0.0.1", 0)
s1 = TCPSocket.open("127.0.0.1", serv.addr[1])
s2 = serv.accept
s2.close
s1.write("a") rescue p $!
s1.write("a") rescue p $!
Thread.new {
s1.write("a")
}.join'
ruby 1.9.3dev (2010-07-06 trunk 28554) [i386-freebsd8.0]
#
-e:10:in write': Broken pipe (Errno::EPIPE)
from -e:10:in
block in '

まぁ、[ruby-core:31065], [ruby-core:31068] の話なんですが。

そういえば、[ruby-dev:34567] というのもありましたが同じかな。
--
[田中 哲][たなか あきら][Tanaka Akira]

Actions

Also available in: Atom PDF