Issue #3543 has been updated by Yui NARUSE.

Description updated

----------------------------------------
Bug #3543: GNU/Linux select hang on a socket which TCP state is  CLOSED
https://bugs.ruby-lang.org/issues/3543#change-55480

* Author: Akira Tanaka
* Status: Third Party's Issue
* Priority: Normal
* Assignee: 
* ruby -v: -
* Backport: 
----------------------------------------
 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]
 #<Errno::EPIPE: Broken pipe>
 ここでハング
 
 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]
 #<Errno::EPIPE: Broken pipe>
 -e:10:in `write': Broken pipe (Errno::EPIPE)
         from -e:10:in `block in <main>'
 
 まぁ、&#91;ruby-core:31065], &#91;ruby-core:31068] の話なんですが。
 
 そういえば、&#91;ruby-dev:34567]というのもありましたが同じかな。
 -- 
 [田中 哲][たなか あきら][Tanaka Akira]




-- 
https://bugs.ruby-lang.org/