Rails logs show `DEBUGGER: Debugger can attach via UNIX domain socket` but VS Code rdbg says "Can not find attachable Ruby process."

3 weeks ago 16
ARTICLE AD BOX

I have two Rails apps that I want to debug with the VS Code rdbg Ruby Debugger extension.

For each of them, I have a launch.json that looks like this (abbreviated):

{ "version": "0.2.0", "configurations": [ { "type": "rdbg", "name": "Attach with rdbg", "request": "attach" } ] }

And I'm invoking my Rails server with RUBY_DEBUG_OPEN="true".

However, in one of my apps I can attach to the running Rails server and in the other I can't. In the non-working app, I see:

Can not find attachable Ruby process.

I think something about the socket might be relevant. The debugger shows this output in the logs for the working app:

11:02:52 web.1 | DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/ry/743cy7l57qlg1c3jq_yy4qc40000gn/T/rdbg-501/rdbg-22368)

and the non-working app, I see:

11:06:08 web.1 | DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/ry/743cy7l57qlg1c3jq_yy4qc40000gn/T/ruby-debug-sock-501/ruby-debug-sam-23097)

The socket name there starts with ruby-debug-sock-, not rdbg-, which seems relevant, since I am trying to use rdbg.

Read Entire Article