hsgubert / cassandra_migrations

Cassandra Migrations is a Cassandra database schema migration library for Rails applications.
MIT License
45 stars 43 forks source link

"No live threads left. Deadlock?" #54

Closed johnrees closed 9 years ago

johnrees commented 9 years ago

I'm trying to get set up with rails-api 4.2, ruby 2.2 (rbenv) and hombrew's cassandra.

I've created my keyspace and run my first migration, but when I go into rails console and run CassandraMigrations::Cassandra.select(:readings)

I get the following error...

fatal: No live threads left. Deadlock?
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/ione-1.2.0/lib/ione/future.rb:658:in `pop'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/ione-1.2.0/lib/ione/future.rb:658:in `value'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/cql-rb-2.0.0/lib/cql/client/client.rb:546:in `block in execute'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/cql-rb-2.0.0/lib/cql/client.rb:60:in `synchronous_backtrace'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/cql-rb-2.0.0/lib/cql/client/client.rb:545:in `execute'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/cassandra_migrations-0.1.0/lib/cassandra_migrations/cassandra.rb:61:in `execute'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/cassandra_migrations-0.1.0/lib/cassandra_migrations/cassandra/queries.rb:61:in `select'
    from (irb):2
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
... 2 levels...
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/commands/rails.rb:6:in `call'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/command_wrapper.rb:38:in `call'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/application.rb:183:in `block in serve'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/application.rb:156:in `fork'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/application.rb:156:in `serve'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/application.rb:131:in `block in run'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `loop'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `run'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/john/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'

Any ideas? I was up and running fine with cequel, but I really want to use this gem because I like having the migrations. Thanks

johnrees commented 9 years ago

I think it might be a spring issue.

I am using the rubystax driver now and this initializer seems to work

Spring.after_fork do
  require 'cassandra'
  cluster = Cassandra.cluster
  $cassandra ||= cluster.connect(ENV['keyspace'])
end
bsbodden commented 9 years ago

Thanks John, I'll see if I can add that to the initialization routine by checking for Spring's presence. Cheers!

bsbodden commented 9 years ago

John. Try my patch form here https://github.com/integrallis/cassandra_migrations.git and see if that works. Let me know and I'll figure out how to write a test for it.

bsbodden commented 9 years ago

See https://github.com/hsgubert/cassandra_migrations/pull/55