Bug #844: Interpreter wide IO deadlock
http://redmine.ruby-lang.org/issues/show/844

Author: coderrr .
Status: Open, Priority: Low

two threads reading from the same socket at same time produces race condition whichs locks interpreter

info at: http://coderrr.wordpress.com/2008/12/10/mri-io-deadlock/

code to repo:

require 'socket'
# if this ever stops printing we're screwed
Thread.new{loop{p 1;sleep 0.5}}

s = Thread.new do
  cli = TCPServer.new(3020).accept
  loop { cli.write 'hi' }
end

sock = TCPSocket.new('localhost', 3020)
2.times do
  Thread.new do
    loop { sock.readpartial 1024 }
  end
end

s.join


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