ruby-debug / ruby-debug-ide

An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine.
https://www.jetbrains.com/ruby/features/ruby_debugger.html
Other
370 stars 83 forks source link

IOError at breakpoint in RubyMine when launching a Rails 5.1.3 app in debug mode within a docker-compose setup #197

Open gdakram opened 3 years ago

gdakram commented 3 years ago

Having a world of trouble getting breakpoint to stick in the app when running the app in debug.

I went through the process in setting up RubyMine with docker-compose for the project here following these steps: https://blog.jetbrains.com/ruby/2019/03/rubymine-docker/

RubyMine specifics in my environment

RubyMine 2020.1.1
Build #RM-201.7223.94, built on April 30, 2020
Runtime version: 11.0.6+8-b765.40 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.6
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12

I launch the app in debug mode, here's the command and ports RubyMine injects at debug launch:

 command:
    - "sh"
    - "-c"
    - "/usr/local/bin/ruby /usr/local/bundle/gems/ruby-debug-ide-0.7.2/bin/rdebug-ide\
      \ --key-value --disable-int-handler --evaluation-timeout 10 --evaluation-control\
      \ --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --port 1234\
      \ --host 0.0.0.0 --dispatcher-port 26168 -- /home/deploy/www/app/bin/rails\
      \ server -b 0.0.0.0 -p 3000 -e development"
ports:
    - "1234:1234"
    - "26166:26168"
    - "3000:3000"
    stdin_open: true

Here's what's in the logs

app_1        | Fast Debugger (ruby-debug-ide 0.7.2, debase 0.2.4.1, file filtering is supported) listens on 0.0.0.0:1234
app_1        | => Booting Puma
app_1        | => Rails 5.1.3 application starting in development on http://0.0.0.0:3000
app_1        | Puma starting in single mode...
app_1        | * Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot
app_1        | * Min threads: 1, max threads: 1
app_1        | * Environment: development
app_1        | * Listening on tcp://0.0.0.0:3000

I set the breakpoint in RubyMine before loading the app on browser. Loading after results in an IOError. The app is unresponsive thereafter and would require a restart and launched without adding breakpoint for it to load in debug mode.

Here's the full stack trace:

ruby-debug-ide (0.7.2) lib/ruby-debug-ide/interface.rb:26:in `write'
ruby-debug-ide (0.7.2) lib/ruby-debug-ide/interface.rb:26:in `printf'
ruby-debug-ide (0.7.2) lib/ruby-debug-ide/interface.rb:26:in `print'
ruby-debug-ide (0.7.2) lib/ruby-debug-ide/xml_printer.rb:481:in `print'
ruby-debug-ide (0.7.2) lib/ruby-debug-ide/xml_printer.rb:420:in `print_breakpoint'
(eval):5:in `block in print_breakpoint'
/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
(eval):3:in `print_breakpoint'
ruby-debug-ide (0.7.2) lib/ruby-debug-ide/event_processor.rb:52:in `line_event'
ruby-debug-ide (0.7.2) lib/ruby-debug-ide/event_processor.rb:34:in `at_line'
debase (0.2.4.1) lib/debase/context.rb:35:in `at_line'
app/controllers/users_controller.rb:6:in `sign_in'
actionpack (5.1.3) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.1.3) lib/abstract_controller/base.rb:186:in `process_action'
actionpack (5.1.3) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.1.3) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.1.3) lib/active_support/callbacks.rb:131:in `run_callbacks'
actionpack (5.1.3) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.1.3) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.1.3) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.1.3) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.3) lib/active_support/notifications.rb:166:in `instrument'
actionpack (5.1.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.1.3) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
activerecord (5.1.3) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.3) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.3) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.3) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.3) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:46:in `block in serve'
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.3) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.3) lib/action_dispatch/routing/route_set.rb:834:in `call'
rack (2.0.3) lib/rack/etag.rb:25:in `call'
rack (2.0.3) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.3) lib/rack/head.rb:12:in `call'
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.3) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.3) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.3) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.3) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.3) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.3) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.3) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.3) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.3) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.3) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
railties (5.1.3) lib/rails/engine.rb:522:in `call'
puma (3.10.0) lib/puma/configuration.rb:225:in `call'
puma (3.10.0) lib/puma/server.rb:605:in `handle_request'
puma (3.10.0) lib/puma/server.rb:437:in `process_client'
puma (3.10.0) lib/puma/server.rb:301:in `block in run'
puma (3.10.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'

If I launch the app in debug mode without breakpoint and then add breakpoint, it's just ignored.

Any pointers would be immensely appreciated. Thanks.