Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Hang while testing Actor on 1.9.3 #20

Closed
mperham opened this Issue Jan 26, 2012 · 8 comments

Comments

Projects
None yet
4 participants
Contributor

mperham commented Jan 26, 2012

Clone mperham/sidekiq and run rake, the tests should run green. Now remove the conditional on lib/sidekiq/processor.rb line 7 and run rake again. It should hang. The associated test is in test/test_processor.rb

Owner

tarcieri commented Jan 27, 2012

As far as I can tell, it's hanging here:

https://github.com/mperham/sidekiq/blob/master/test/test_processor.rb#L29

This looks like an issue with the interaction of Celluloid and MiniTest::Mock

Step one is to figure out what exactly is going on and why this is deadlocking

Owner

tarcieri commented Jan 27, 2012

This isn't a deadlock actually. It looks like an infinite loop.

Owner

tarcieri commented Jan 27, 2012

Orthogonal to this particular bug, but is what you want here actually a mock actor? Would it be useful if there were a Celluloid-based mocking framework for making mock actors?

Member

benlangfeld commented Jan 27, 2012

I see RSpec tests hang when expectations on actors are not met (using Mocha). I'll get a simple test case up to demonstrate.

Member

benlangfeld commented Jan 27, 2012

I'm struggling to remember the conditions under which this hang occurs, but in the mean time, this is an interesting related issue. Let me know if you'd prefer a separate ticket for it:

require 'celluloid'

class AnActor
  include Celluloid

  def initialize(other)
    @other = other
  end

  def foo
    :foo
  end

  def bar
    :bar
  end
end

require 'rspec'
require 'mocha'

RSpec.configure do |config|
  config.mock_framework = :mocha
end

describe AnActor do
  it "should fail because foo does not call bar" do
    subject.wrapped_object.expects(:bar).once
    subject.foo
  end
end
{20:56}[ruby-1.9.3]~/Desktop ben% rspec mocha_celluloid.rb
F

Failures:

  1) AnActor should fail because foo does not call bar
     Failure/Error: Unable to find matching line from backtrace
     SystemStackError:
       stack level too deep
     # /Users/ben/Developer/.rvm/gems/ruby-1.9.3-p0/gems/mocha-0.10.3/lib/mocha/names.rb:10

Finished in 0.02736 seconds
1 example, 1 failure

Failed examples:

rspec ./mocha_celluloid.rb:23 # AnActor should fail because foo does not call bar

on JRuby:


{21:12}[jruby-1.6.5]~/Desktop ben% rspec mocha_celluloid.rb        
F

Failures:

  1) AnActor should fail because foo does not call bar
     Failure/Error: Unable to find matching line from backtrace
     SystemStackError:
       stack level too deep
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:122:in `inspect'
     # org/jruby/RubyArray.java:2326:in `collect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/celluloid-0.8.0/lib/celluloid.rb:121:in `inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/inspect.rb:9:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/names.rb:10:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:190:in `mocha_inspect'
     # /Users/ben/Developer/.rvm/gems/jruby-1.6.5/gems/mocha-0.10.3/lib/mocha/mock.rb:194:in `inspect'

Finished in 4.22 seconds
1 example, 1 failure

Failed examples:

rspec ./mocha_celluloid.rb:23 # AnActor should fail because foo does not call bar
rspec mocha_celluloid.rb  20.44s user 0.91s system 261% cpu 8.173 total
Owner

tarcieri commented Jan 28, 2012

Yeah ugh, I'm really starting to think at this point that I'm not going to be able to solve all of the compatibility problems between the various mocking frameworks out there and Celluloid.

The idea of making a Celluloid-specific mocking framework that supports mocking both objects and actors is definitely growing on me.

rue commented Jan 28, 2012

I think the domain might require a purpose-built mock framework, too.

Owner

tarcieri commented Feb 7, 2012

Purpose-built mock framework now covered as #26

@tarcieri tarcieri closed this Feb 7, 2012

halorgium added a commit that referenced this issue Nov 29, 2014

Merge pull request #20 from halorgium/bypass-actor-for-wait
ActorProxy is used for suspending IO tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment