Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal: deadlock detected - During debugger gem #332

Closed
mindbreaker opened this issue Dec 7, 2012 · 15 comments
Closed

fatal: deadlock detected - During debugger gem #332

mindbreaker opened this issue Dec 7, 2012 · 15 comments

Comments

@mindbreaker
Copy link

I tried to run some tests with the twitter gem. To inspect the callbacks i use the ruby-debug gem. I tried to make an API call like @client2.favorite(tweet.id). And then i've got this error message.

ruby-1.9.3-p125 :002 > @client2.favorite(tweet.id)
fatal: deadlock detected
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.0/lib/twitter/core_ext/enumerable.rb:9:in `value'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.0/lib/twitter/core_ext/enumerable.rb:9:in `map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.0/lib/twitter/core_ext/enumerable.rb:9:in `block in threaded_map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.0/lib/twitter/core_ext/enumerable.rb:18:in `abort_on_exception'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.0/lib/twitter/core_ext/enumerable.rb:4:in `threaded_map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.0/lib/twitter/api/favorites.rb:80:in `favorite'
from (irb):2:in `block (3 levels) in <top (required)>'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:275:in `one_cmd'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:261:in `block (2 levels) in process_commands'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:260:in `each'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:260:in `block in process_commands'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:253:in `catch'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:253:in `process_commands'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:173:in `at_line'
from (eval):5:in `block in at_line'
from <internal:prelude>:10:in `synchronize'
... 5 levels...
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:195:in `with_around_each_hooks'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:84:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:353:in `block in run_examples'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `run_examples'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:335:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `block in run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block in run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/reporter.rb:34:in `report'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:25:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'ruby-1.9.3-p125 :003 > 
@mattherick
Copy link

same here!

@sferik
Copy link
Owner

sferik commented Dec 7, 2012

I'm looking into it. I think I know what the problem is.

@mattherick Can you let me know the specific version of Ruby you are using, including the patchlevel?

@mattherick
Copy link

@sferik ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.4.2]
it is the same like @mindbreaker 's one.

@sferik
Copy link
Owner

sferik commented Dec 7, 2012

🔍 …as I suspected… 🔎

@sferik
Copy link
Owner

sferik commented Dec 7, 2012

I'm having trouble reproducing this, even on exact same Ruby version. Does it happen every time you call favorite or just sometimes? Is it possible for either of you to try upgrading to Ruby 1.9.3-p327 to see if that fixes it?

@mattherick
Copy link

It happens every time, but not only while calling "favorite" in the debgugger. If I call "retweet" it is the same.. I'll try it with Ruby 1.9.3-p327. Probably something with the Threading?

@sferik
Copy link
Owner

sferik commented Dec 7, 2012

Yeah, I think I know what it is now.

@sferik sferik closed this as completed in 6de998c Dec 7, 2012
@sferik
Copy link
Owner

sferik commented Dec 7, 2012

It should be fixed in master. Please update your Gemfile to specify the dependency as:

gem 'twitter', github: 'sferik/twitter'

Then bundle install and verify that this patch fixes the bug. If so, I'll ship a new gem later today or tomorrow.

@mindbreaker
Copy link
Author

Hi,

i tried it again with your new patch level. But it doesnt work ;(
Have you tried with an newer patchlevel of ruby?

ruby-1.9.3-p125 :001 > @client1.retweet("278139435567177729")
fatal: deadlock detected
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.1/lib/twitter/core_ext/enumerable.rb:7:in `value'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.1/lib/twitter/core_ext/enumerable.rb:7:in `map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.1/lib/twitter/core_ext/enumerable.rb:7:in `threaded_map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/twitter-4.4.1/lib/twitter/api/tweets.rb:148:in `retweet'
from (irb):1:in `block (3 levels) in <top (required)>'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:275:in `one_cmd'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:261:in `block (2 levels) in process_commands'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:260:in `each'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:260:in `block in process_commands'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:253:in `catch'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:253:in `process_commands'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:173:in `at_line'
from (eval):5:in `block in at_line'
from <internal:prelude>:10:in `synchronize'
from (eval):3:in `at_line'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/debugger-1.1.3/lib/ruby-debug-base.rb:54:in `at_line'
... 3 levels...
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:195:in `with_around_each_hooks'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:84:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:353:in `block in run_examples'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `run_examples'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:335:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `block in run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `map'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block in run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/reporter.rb:34:in `report'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:25:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
from /home/tom/.rvm/gems/ruby-1.9.3-p125@if/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'ruby-1.9.3-p125 :002 >

@mattherick
Copy link

I also tried it again with 1.9.3-p286, samer error:

irb(#<RSpec::Core::ExampleGroup::Nested_2::Nested_1:0x007fc734991af8>):001:0> @client1.retweet(269890503431028736)
fatal: deadlock detected
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/twitter-4.4.1/lib/twitter/core_ext/enumerable.rb:7:in `value'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/twitter-4.4.1/lib/twitter/core_ext/enumerable.rb:7:in `map'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/twitter-4.4.1/lib/twitter/core_ext/enumerable.rb:7:in `threaded_map'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/twitter-4.4.1/lib/twitter/api/tweets.rb:148:in `retweet'
from (irb):1:in `block (3 levels) in <top (required)>'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:275:in `one_cmd'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:261:in `block (2 levels) in process_commands'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:260:in `each'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:260:in `block in process_commands'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:253:in `catch'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:253:in `process_commands'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/debugger-1.1.3/lib/ruby-debug/processor.rb:173:in `at_line'
from (eval):5:in `block in at_line'
from <internal:prelude>:10:in `synchronize'
from (eval):3:in `at_line'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/debugger-1.1.3/lib/ruby-debug-base.rb:54:in `at_line'
... 3 levels...
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:195:in `with_around_each_hooks'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:84:in `run'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:353:in `block in run_examples'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `map'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `run_examples'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:335:in `run'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `block in run'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `map'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `run'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `map'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block in run'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/reporter.rb:34:in `report'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:25:in `run'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:69:in `run'
from /Users/matthiasfrick/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/lib/rspec/core/runner.rb:10:in `block in autorun'irb(#<RSpec::Core::ExampleGroup::Nested_2::Nested_1:0x007fc734991af8>):002:0> cont

.

@sferik
Copy link
Owner

sferik commented Dec 10, 2012

Hmmm. I have no idea what the problem is. I've installed Ruby 1.9.3-p125 and added debugger to my Gemfile but am unable to reproduce the error. Could you please answer some additional questions:

  1. What operating system are you using? @mattherick, it looks like you're on a Mac. @mindbreaker, you appear to be using Linux? Can you both please let me know the full output of the command:

    uname -a
    
  2. What version of the debugger gem are you using? You both appear to be using version 1.1.3. Can you please try updating to version 1.2.2 and let me know if that fixes it.

  3. Does the problem go away if you remove the debugger gem altogether?

  4. When you run the following command on your system:

    git clone git://github.com/sferik/twitter.git &&\
    cd twitter &&\
    bundle install &&\
    bundle exec rake spec
    

    Do the specs pass or fail?

  5. Try adding the debugger gem to the project's Gemfile and run:

    bundle install &&\
    bundle exec rake spec
    

    Do the specs pass or fail?

  6. Try checking out the celluloid branch:

    git checkout celluloid &&\
    bundle install &&\
    bundle exec rake spec
    

    Do the specs pass or fail?

Thanks in advance for performing all of these diagnostic steps. I'd go through these steps myself but I am unable to reproduce this issue on my computer. If one or (preferably) both of you both report the answers to all these questions, I'll have a much better idea of what the problem is.

@mattherick
Copy link

  1. Darwin Matthiass-MacBook-Pro.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
  2. Updated to debugger 1.2.2 - same result
  3. The problem only appears, if I add the debugger and then I call in the console a Twitter method. If I just "cont" the debugging mode - everything works fine
  4. all specs are green
  5. all specs are green
  6. all specs are green

@sferik
Copy link
Owner

sferik commented Dec 10, 2012

@cldwalker Any ideas what might be causing this?

@cldwalker
Copy link

Not beyond what's obvious from the stacktrace - threads from Enumerable#threaded_map are conflicting with debugger's threaded setup. If it's any comfort, I'm able to get a deadlock doing a simple version of threaded_map on the latest 1.9.3 ruby i.e.: threads = []; [1,2,3].each {|obj| threads << Thread.new { yield obj } }; threads.map(&:value) . I can open an issue on debugger if you'd like and leave it for any takers.

@sferik
Copy link
Owner

sferik commented Dec 11, 2012

@cldwalker That sounds good. 🎵👂👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants