lnussbaum / xmpp4r

XMPP/Jabber Library for Ruby - please use:
http://github.com/xmpp4r/xmpp4r
Other
312 stars 1 forks source link

"deadlock detected (fatal)" from roster.add() #26

Open ssoroka opened 12 years ago

ssoroka commented 12 years ago

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 <internal:prelude>: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?

astro commented 12 years ago

Not that I were maintaining xmpp4r anymore, but please check in what thread you're invoking that, and if it locked resources at this point.

ssoroka commented 12 years ago

So is this:

A) My fault for not using a thread or locking properly in my application code? B) xmpp4r's fault for locking when it doesn't need to? or C) A bug in Ruby 1.9.3? such as: http://bugs.ruby-lang.org/issues/4266

bobbrez commented 12 years ago

Even with the examples its getting the "deadlock detected" exception. It sounds like it is probably more B