Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Hang while testing Actor on 1.9.3 #20

Closed
mperham opened this Issue · 8 comments

4 participants

@mperham

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

@tarcieri
Owner

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

@tarcieri
Owner

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

@tarcieri
Owner

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?

@benlangfeld
Collaborator

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

@benlangfeld
Collaborator

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
@tarcieri
Owner

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

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

@tarcieri
Owner

Purpose-built mock framework now covered as #26

@tarcieri tarcieri closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.