I'm trying to debug a rails application running in a k8s cluster.
The stack used is the following: Ruby '2.6.6' - Docker Engine v20.10.2 - Kubernetes v1.19.3 - Skaffold v1.17.2 - MacOS BigSur 11.1
Skaffold is running with skaffold dev --port-forward
In Dockerfile i have CMD ["rdebug-ide", "--debug", "--host", "0.0.0.0", "--port", "1234", "--dispatcher-port", "5884", "--", "bin/bundle", "exec", "rails", "s"]
The service yaml for this app is like:
apiVersion: v1
kind: Service
metadata:
name: system-management-srv
spec:
selector:
app: system-management
ports:
- name: system-management
port: 3000
- name: debug
port: 1234
When i start the "RemoteDebug" configuration, it can detect the breakpoints, but the output error is:
[system-management] Connected from local client
[system-management] 1: Starting control thread
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:25
[system-management] 1: <breakpointAdded no="1" location="/project/app/controllers/api/v1/services_controller.rb:25"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:28
[system-management] 1: <breakpointAdded no="2" location="/project/app/controllers/api/v1/services_controller.rb:28"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:29
[system-management] 1: <breakpointAdded no="3" location="/project/app/controllers/api/v1/services_controller.rb:29"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:27
[system-management] 1: <breakpointAdded no="4" location="/project/app/controllers/api/v1/services_controller.rb:27"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:7
[system-management] 1: <breakpointAdded no="5" location="/project/app/controllers/api/v1/services_controller.rb:7"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:24
[system-management] 1: <breakpointAdded no="6" location="/project/app/controllers/api/v1/services_controller.rb:24"/>
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:11
[system-management] 1: <breakpointAdded no="7" location="/project/app/controllers/api/v1/services_controller.rb:11"/>
[system-management] 1: Processing in control: start
[system-management] 1: Starting: running program script
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide/multiprocess/starter.rb:3:in `<top (required)>': undefined method `split' for nil:NilClass (NoMethodError)
[system-management] from bin/rails:1:in `require'
[system-management] Fast Debugger (ruby-debug-ide 0.7.2, debase 0.2.4.1, file filtering is supported) listens on 0.0.0.0:1234
WARN[3324] exit status 1
[system-management] error: unexpected EOF
How can i make it work?
EDIT:
i tried adding
ENV DEBUGGER_STORED_RUBYLIB ''
ENV RUBYLIB ''
as suggested here, but still facing errors
[system-management] 1: Processing in control: b /project/app/controllers/api/v1/services_controller.rb:11
[system-management] 1: <breakpointAdded no="7" location="/project/app/controllers/api/v1/services_controller.rb:11"/>
[system-management] 1: Processing in control: start
[system-management] 1: Starting: running program script
[system-management] 1: connection failed(1)
[system-management] Exception: Connection refused - connect(2) for "127.0.0.1" port 5884
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide.rb:201:in `initialize'
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide.rb:201:in `open'
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide.rb:201:in `block in notify_dispatcher_if_needed'
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide.rb:199:in `times'
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide.rb:199:in `notify_dispatcher_if_needed'
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide.rb:146:in `block in _start_control_common'
[system-management] Fatal exception in DebugThread loop: undefined method `accept' for 3:Integer
[system-management] Backtrace:
[system-management] /usr/local/bundle/gems/ruby-debug-ide-0.7.2/lib/ruby-debug-ide.rb:160:in `block in _start_control_common'
[system-management] Fast Debugger (ruby-debug-ide 0.7.2, debase 0.2.4.1, file filtering is supported) listens on 0.0.0.0:1234
question from:
https://stackoverflow.com/questions/65917191/remote-debug-rails-app-on-kubernetes-with-rubymine 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…