0

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.

1
  • Switching to using a port rather than a socket helped here - see instructions at stackoverflow.com/a/78497823/328817. But I want to use sockets as I have multiple processes and it's hard to set the port for each independently. Commented Nov 11 at 10:53

1 Answer 1

0

It turned out to be caused by having an old version of the ruby/debug gem.

In the working app, ruby/debug was 1.9.2 (I looked in Gemfile.lock) and in the non-working site, it was 1.8.0.

When I upgraded the version of ruby/debug, the socket name changed to have the rdbg- prefix and I could attach the debugger.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.