Open vitobotta opened 3 months ago
@vitobotta Did you ever solve this issue? I'm experiencing something similar
Platform: MacOS
I'm running an app using docker and expose the port
bundle exec rdbg -n --open --host 0.0.0.0 --port 12345 -c -- bin/rails s
ports:
- "12345:12345"
My launch configuration:
{
"type": "rdbg",
"name": "Attach rdbg at :12345",
"request": "attach",
"debugPort": "localhost:12345",
"localfsMap": "/opt/app-root:${workspaceFolder}"
}
My workspace root maps to /opt/app-root
dir inside the running container, but when I attach the debugger it connects and complains that not such file exists
app-1 | DEBUGGER: Connected.
app-1 | DEBUGGER: ReaderThreadError: No such file or directory @ rb_check_realpath_internal - {workspacePath}/config/application.rb
Any help anyone can provide would be greatly appreciated!
Hi, if I remember correctly the only major change I made to make it work was to activate the debugger from my ruby code instead of using the rdbg
binary. I can't remember if there was something else.
Hi! I'll try to explain what my problem is.
I just switched to Solid Queue for background job, and I couldn't get rdbg to run on a TCP port because of the way Solid Queue handles child processes, so I ended up using a socket instead.
However Solid Queue is running in a remote container in a Kubernetes cluster, and I am trying to debug remotely since I use Okteto to work with the cluster.
Since it's a remote container, I am using socat in the container to expose the unix socket via a TCP port which I can then port-forward to my local machine. This works great and VsCode can connect to the debugger as expected.
However with this configuration VsCode has trouble setting the breakpoints, because a newline character is appended to the filename so it cannot find the file locally, event though the path - minus the newline character at the end - does exist and is valid.
My launch configuration:
Where
/home/app/backend
is the root of the Rails app in the container, and 32002 is the port at which socat exposes the unix socket in the remote container, and then that port is forwarded to my local machine at 0.0.0.0.Start script in the container that exposes the unix socket via tcp:
In the debugger output in VsCode I see this when I set a breakpoint:
Notice the
\n
at the end of the path. I believe this is why it cannot find the file and therefore the breakpoint doesn't work. But like I said the path, without the newline character at the end, does exist and points to the expected file.Are there any workarounds? Is this an actual bug or am I missing something in my configuration?
Perhaps also worth mentioning that with the same lunch configuration for other processes that can use rdbg with a tcp port directly, all works great. So the problem occurs only with the unix socket config.
Thanks in advance for any help!