Backport #9132

Mutex error while using EM.defer with Ruby 2.0.0

Added by shurab (Alexander Babichev) over 5 years ago. Updated about 3 years ago.



We are in process of migrating our gem from ruby-1.9.3 to ruby-2.0.0. While running rspec examples with v2.0.0
sometimes the following error happens:

/usr/local/lib/ruby/2.0.0/thread.rb:188:in synchronize': Attempt to unlock a mutex which is locked #by another thread (ThreadError)
from /usr/local/lib/ruby/2.0.0/thread.rb:188:in
block in pop'
from /usr/local/lib/ruby/2.0.0/thread.rb:187:in handle_interrupt'
from /usr/local/lib/ruby/2.0.0/thread.rb:187:in
from /usr/local/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:1036:in #`block in spawn_threadpool'

Initially, I thought that might be related to this EnventMachine issue:

But more detailed analysis shows that it might be ruby-2.0.0:

  • mutex error never been observed with ruby-1.9.3-p448, ruby 2.1.0dev(2013-11-20 trunk 43737), and rbx-2.1.1
  • error happens with ruby-2.0.0-p247, and stable snapshot ruby 2.0.0p350 (2013-11-20 revision 43733)

How to reproduce it: see gist
Environment: ruby-2.0.0-427, eventmachine (1.0.3), rspec (2.14.1)


Updated by nagachika (Tomoyuki Chikanaga) over 5 years ago

  • Status changed from Open to Feedback

I cannot reproduce with 2.0.0-p247 on my laptop with Gemfile shown below.
Is it platform dependent?

== Gemfile ==
source ""

gem "eventmachine"
gem "rspec"


Updated by nagachika (Tomoyuki Chikanaga) over 5 years ago

  • Status changed from Feedback to Open

Sorry, I can reproduce with more trial.

Updated by (Aaron Stone) over 4 years ago

Any idea what is going on here? It is hurting eventmachine:


Updated by naruse (Yui NARUSE) about 3 years ago

  • Status changed from Open to Rejected

Also available in: Atom PDF