ln/xmpp4r — Issue #26: "deadlock detected (fatal)" from roster.add()
Author: ssoroka
Created: 2012-02-03 07:08:22+00:00
State: open

My code that caused the deadlock is pretty much just:

roster = Jabber::Roster::Helper.new(cl)
roster.add(email, name, true)

Exception is:

~/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/thread.rb:71:in `sleep': deadlock detected (fatal)
from ~/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/thread.rb:71:in `wait'
from ./vendor/bundle/ruby/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/semaphore.rb:24:in `block in wait'
from :10:in `synchronize'
from ./vendor/bundle/ruby/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/semaphore.rb:23:in `wait'
from ./vendor/bundle/ruby/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:331:in `wait'
from ./vendor/bundle/ruby/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:398:in `send'
from ./vendor/bundle/ruby/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:432:in `send_with_id'
from ./vendor/bundle/ruby/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/roster/helper/roster.rb:332:in `add'

Only happens in (some versions of?) Ruby 1.9.3, can't reproduce in Ruby 1.8.7.

Am I missing code to prevent deadlocks?