Bug #844 [ruby-core:20446]

Interpreter wide IO deadlock

Added by coderrr . 462 days ago. Updated 443 days ago.

Status :Closed Start :12/10/2008
Priority :Low Due date :
Assigned to :- % Done :

100%

Category :-
Target version :-
ruby -v :


Description

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

Associated revisions

Revision 21165
Added by akr 443 days ago

  • eval.c (rb_thread_schedule): Don't change status of threads which don't run next even if select notify readability/writability. [ruby-core:20446]

History

12/29/2008 04:36 PM - Yukihiro Matsumoto

Hi,

In message "Re: [ruby-core:20907] Re: [Bug #844] Interpreter wide IO deadlock"
    on Sat, 27 Dec 2008 12:51:46 +0900, Tanaka Akira <akr@fsij.org> writes:

|> I investigated the problem.
|
|There is similar problem with write.

|Updated patch:
|
|% svn diff --diff-cmd diff -x '-u -p'
|Index: eval.c

Can you check in?

							matz.

12/29/2008 05:07 PM - Akira Tanaka

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
Applied in changeset r21165.

Also available in: Atom PDF