remote debugging docker

Hello,

I am trying to setup remote debugging to connect to my rails app running in a docker container. I followed the tutorial found here. Everything works fine (debugger connects and loads the rails app) until the set breakpoint is hit. When that happens, the debugger shows a "Frame is not available" message and I am unable to do anything other than resume program or stop the debugger. The rails 4.1 app is using ruby 2.2.3 and I am installing rdebug-ide in the docker container using "gem install ruby-debug-ide". I am using Rubymine 8 and any help would be greatly appricated. Please let me know if more details are needed.

16 comments

Can you try adding --debug to the command line and attach full output of the process

0

Hello Dennis,

The result of adding debug is:

web_1 | 1: <breakpoint file="/app/app/models/user.rb" line="85" threadId="15"/> web_1 | 1: Stopping Thread #<Thread:0x0055a9a764a018> (1) web_1 | 1: Processing in control: th l web_1 | 1: <threads> web_1 | 1: <thread id="2" status="sleep" pid="1" /> web_1 | 1: <thread id="10" status="sleep" pid="1" /> web_1 | 1: <thread id="11" status="sleep" pid="1" /> web_1 | 1: <thread id="12" status="sleep" pid="1" /> web_1 | 1: <thread id="13" status="sleep" pid="1" /> web_1 | 1: <thread id="14" status="sleep" pid="1" /> web_1 | 1: <thread id="15" status="sleep" pid="1" /> web_1 | 1: <thread id="16" status="sleep" pid="1" /> web_1 | 1: <thread id="17" status="sleep" pid="1" /> web_1 | 1: <thread id="18" status="sleep" pid="1" /> web_1 | 1: <thread id="19" status="sleep" pid="1" /> web_1 | 1: </threads> web_1 | 1: Processing in control: th l web_1 | 1: <threads> web_1 | 1: <thread id="2" status="sleep" pid="1" /> web_1 | 1: <thread id="10" status="sleep" pid="1" /> web_1 | 1: <thread id="11" status="sleep" pid="1" /> web_1 | 1: <thread id="12" status="sleep" pid="1" /> web_1 | 1: <thread id="13" status="sleep" pid="1" /> web_1 | 1: <thread id="14" status="sleep" pid="1" /> web_1 | 1: <thread id="15" status="sleep" pid="1" /> web_1 | 1: <thread id="16" status="sleep" pid="1" /> web_1 | 1: <thread id="17" status="sleep" pid="1" /> web_1 | 1: <thread id="18" status="sleep" pid="1" /> web_1 | 1: <thread id="19" status="sleep" pid="1" /> web_1 | 1: </threads> web_1 | 1: Threads equal: true web_1 | 1: Processing in control: th l web_1 | 1: <threads> web_1 | 1: <thread id="2" status="sleep" pid="1" /> web_1 | 1: <thread id="10" status="sleep" pid="1" /> web_1 | 1: <thread id="11" status="sleep" pid="1" /> web_1 | 1: <thread id="12" status="sleep" pid="1" /> web_1 | 1: <thread id="13" status="sleep" pid="1" /> web_1 | 1: <thread id="14" status="sleep" pid="1" /> web_1 | 1: <thread id="15" status="sleep" pid="1" /> web_1 | 1: <thread id="16" status="sleep" pid="1" /> web_1 | 1: <thread id="17" status="sleep" pid="1" /> web_1 | 1: <thread id="18" status="sleep" pid="1" /> web_1 | 1: <thread id="19" status="sleep" pid="1" /> web_1 | 1: </threads> web_1 | 1: Processing in context: w web_1 | 1: <frames> web_1 | 1: <frame no="1" file="/app/app/models/user.rb" line="85" current='true' /> web_1 | 1: <frame no="2" file="/usr/local/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/bundler/gems/two_factor_authentication-14adcce36236/lib/two_factor_authentication/hooks/two_factor_authenticatable.rb" line="3" /> web_1 | 1: <frame no="3" file="/usr/local/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/warden-1.2.3/lib/warden/hooks.rb" line="14" />

0

Hello Dennis,

Did anything stick out in the debug? Also, can you confirm what gems/libs are necessary for the remote debugging to work. I have installed ruby-debug-ide and debase, both result in the issue as shown in the debug.

Thanks!

0

Can you attach contents of your Gemfile as well?

0

Gemfile:


source 'https://rubygems.org'
ruby '2.2.3'

# Core application framework
gem 'rails', '~> 4.1', '>= 4.1.14'
gem 'pg', '~> 0.18.4'

### Active Record Modifications ###
# Adds versioning
gem 'paper_trail', '~> 4.0.0'
gem 'paperclip', github: 'thoughtbot/paperclip'
# Adds soft delete functionality
gem 'paranoia', '~> 2.0'
# PG extensions for arrays
gem 'postgres_ext'

### Rails Assets ###
# Asset pipeline
gem 'sass-rails', '~> 5.0', '>= 5.0.4'
gem 'coffee-rails', '~> 4.1'
gem 'uglifier', '~> 2.5.3'

# Standard JS libraries
gem 'jquery-rails', '~> 3.1.2'
gem 'underscore-rails'
gem 'jquery-ui-rails', '~> 5.0.3'

# Integration for AJAX datatables
gem 'ajax-datatables-rails', github: 'StepsAway/ajax-datatables-rails'

### Authentication/Authorization ###
# Authentication framework
gem 'devise', '~> 3.5', '>= 3.5.2'
gem 'devise-async', '~> 0.10.1'
gem 'two_factor_authentication', github: 'StepsAway/two_factor_authentication'
gem 'pundit', '~> 1.0', '>= 1.0.1'
gem 'rolify', '~> 4.1.1'

gem 'country_select', github: 'stefanpenner/country_select'
gem 'geocoder', '~> 1.2.8'
gem 'timezone'
gem 'draper', '~> 1.3'
gem 'simple_form', '~> 3.1.0'
gem 'browser', git: 'https://github.com/StepsAway/browser.git'
gem 'crypt'

source 'https://rails-assets.org' do
  gem 'rails-assets-jquery-timepicker-jt'
end

gem 'nokogiri', '~> 1.6.5'

gem 'aws-sdk-rails', '~> 1.0.0'
gem 'aws-sdk', '~> 2'
gem 'net-scp', '~> 1.1.0'
gem 'newrelic_rpm'
gem 'ejs'
gem 'passenger', '~> 5.0', '>= 5.0.21'
gem 'pubnub', '~> 3.7.1'
gem 'rack-cors', :require => 'rack/cors'
gem 'twilio-ruby', '~> 3.11'
gem 'honeybadger', '~> 2.1.4'
gem 'non-stupid-digest-assets', '~> 1.0.4'
gem 'pry', require: nil
gem 'sidekiq', '~> 3.3.4'
gem 'retail_calendar', '~> 1.2.0'
gem 'sinatra', require: nil
gem 'jwt', '~> 1.5.0'
gem 'zendesk_api', '~> 1.9.3', require: nil
gem 'ipaddress', '~> 0.8.0'
gem 'public_suffix', '~> 1.5.1'
gem 'iron_mq', '~> 5.0.1'
gem 'strip_attributes', '~> 1.7', '>= 1.7.1'
gem 'ruby-debug-ide', '~> 0.6.0'

source 'https://gem.fury.io/stepsaway/' do
  gem 'SaPeeper', '>=1.3.0'
end

group :staging, :production do
  # Needed for heroku support
  gem 'rails_12factor'
end

group :development do
  # Detects places where eager loading improves performance
  gem 'bullet'
  # Development webserver
  gem 'webrick', '= 1.3.1'
  # Code profiler
  gem 'ruby-prof'

  gem 'quiet_assets'
  gem 'guard'
  gem 'guard-minitest'
  gem 'spring'
end

group :development, :test do
  # Factories
  gem 'factory_girl_rails', '~> 4.5.0'
end

group :test do
  # Rails Minitest framework
  gem 'minitest-rails'
  # Minitest test reporters for TC integration
  gem 'minitest-reporters', '~> 1.0.20'
  # Minitest around blocks
  gem 'minitest-around'
  # Wipe db between test runs
  gem 'database_cleaner', '~> 1.4.1'
  gem 'minitest-fail-fast'
  # Create database tables on the fly
  gem 'temping', '~> 3.3.0'
  # Allow after_commit hooks to be tested, obsolete in Rails 5
  gem 'test_after_commit'
end



Also, I am installing ruby-debug-ide in the docker container to ensure it is excutable from the cli.

0

So you're running passenger server? Can you try with some other one (e.g. default WEBrick)?

0

Passenger is only being used in production. I should actually move that gem to the production group. The app server was starting with WEBrick. I also just tried it with Thin and am experiencing the same result.

0

Did either of you find a resolution to this? I have a very similar situation (rails app in docker container with remote debugging on RubyMine 8) and am experiencing the exact problem. All frames show up as "Stack frame is not available" except the first, even though the output from the debugger indicates that it is sending frame info. Any info to point me in the right direction to fixing this would be much appreciated!

0

Sorry Henry,

I never found a solution to the issue, though it will still be very nice to have.

0

Sorry for the delayed reply.

We were able to reproduce this problem and it seems to be caused by current limitation of remote debugging - you're able to specify only one mapping for configuration, so only app files are properly mapped. There is another problem that we're not loading variables if we're unable to determine mapped file.

I can suggest to bundle gems into vendor/gems as a workaround and on our side I'll try to load variables even if mapping is missing

0

Thanks, Dennis. This is info is very helpful. I'll try bundling to vendor/gems, or maybe I can try to match the environments with some clever symlinking. I'll post back here if either of those approaches work. Thanks again.

0

Hey JD, Dennis, I just wanted to leave a note that symlinking (on my local dev) the gems directory to a path that is the same as where the gems are in the container worked.

e.g.

ln -s /somewhere/on/my/local/lib/ruby/gems/2.2.2 /same/path/as/gems/directory/in/container

It's not the cleanest solution, and might not be possible in certain environments, but it does work. I hope this helps you guys.

0

However your post does not solve the problem for us poor Windows users. We can't mirror the locations on our local FS.

1

Hello,

I am another new RubyMine/Docker Windows user, any news will this "Stack Frame not available on Docker/Ruby IDE" solved in future versions?

Thanks Pekka

0

Please sign in to leave a comment.