iconara / cql-rb

Cassandra CQL 3 binary protocol driver for Ruby
106 stars 31 forks source link

No live threads left. Deadlock? when saving object #124

Closed AdamMarkowski closed 9 years ago

AdamMarkowski commented 9 years ago

Hi guys! I have trouble when trying to save object using datastax_rails:

2.1.5 :001 > user = User.new(bio: 'test')
 => #<User id: nil, first_name: nil, user_name: nil, bio: "test", birthdate: nil, active: nil, created_at: nil, updated_at: nil> 
2.1.5 :002 > user.save!
fatal: No live threads left. Deadlock?
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/ione-45e1f52da02d/lib/ione/future.rb:667:in `pop'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/ione-45e1f52da02d/lib/ione/future.rb:667:in `value'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/gems/cql-rb-2.0.4/lib/cql/client/client.rb:553:in `block in prepare'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/gems/cql-rb-2.0.4/lib/cql/client.rb:60:in `synchronous_backtrace'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/gems/cql-rb-2.0.4/lib/cql/client/client.rb:553:in `prepare'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/cql/base.rb:42:in `block in execute'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `block in instrument'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `instrument'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/cql/base.rb:29:in `execute'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:154:in `write_with_cql'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:83:in `block (2 levels) in write'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/notifications.rb:166:in `instrument'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:77:in `block in write'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:76:in `tap'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@activiter/bundler/gems/datastax_rails-eec9c50dd18d/lib/datastax_rails/persistence.rb:76:in `write'
... 22 levels...
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
    from /Users/adammarkowski/IdeaProjects/Activiter/bin/rails:8:in `<top (required)>'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/adammarkowski/.rvm/gems/ruby-2.1.5@global/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
    from /Users/adammarkowski/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/adammarkowski/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'2.1.5 :003 > 

Because it might be caused by ione or cql-rb and I have no idea whats going on, I want to ask if you met this error earlier? Testes against ruby 2.0.0 & 2.1.5, rails 4.0.0 & 4.2.0.

iconara commented 9 years ago

Thank you for the bug report. cql-rb has been replaced by DataStax Ruby driver.

Most likely you're getting the error because your process forked after it connected. The driver runs a background thread and opens multiple sockets, and neither of these will be alive in the child process. This is covered, along with workarounds, in the readme under the heading 'I get "Deadlock detected" errors'.