You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected stoppage on remote debugging connection #629
And I'll need to manually skip the first few frames every time the connection is established, which is annoying. One example:
❯ ~/projects/debug/exe/rdbg -A
# No sourcefile available for /Users/st0012/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/puma-5.6.2/lib/puma/single.rb
=>#0 [C] Thread#join at ~/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/puma-5.6.2/lib/puma/single.rb:61
#1 Puma::Single#run at ~/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/puma-5.6.2/lib/puma/single.rb:61
# and 16 frames (use `bt' command for all frames)
Stop by SIGURG
(rdbg:remote)
So my questions are:
Why does the debugger need to stop for this signal?
If it's needed in some cases, can we skip this behavior when nonstop flag is used?
rdbg -An can be more useful to control the behavior?
I used rdbg -A for demonstrating the issue but usually we use it with VSCode. So ideally it should be set from the debuggee along with nonstop too.
It is useful to analyze what happens on the program.
For the use cases I see (mostly attaching to a Rails server), I don't see much need for that. But it stopping at places like puma's internal (as shown above) is confusing and annoying.
Let me also explain how we use the debugger with our development tooling:
Define a server service with debugger enabled:
server: rdbg -O -n --sock-path=$RUBY_DEBUG_SOCK_DIR/ruby-debug-server -- bin/rails s
Start the server service for developer server.
When we want to add breakpoints, we write debug statements (binding.b) in code and restart the server service. (Most people are still used this way to add bps)
Attach to the debuggee from VSCode.
And ideally, the server should run normally until we hit the breakpoint after reloading the page or making a request. But we always end up stopping at this place and then need to click continue multiple times.
So IMO, it'd be great to make it optional and also non-default.
For me, it also seems to lose the attached debugger sometimes on subsequent requests. The server would say "wait for debugger connection..." while the client debugger that was attached would be blocked waiting — even ctrl-C would do nothing.
I understand the scenario on #629 (comment).
If we do "nonstop" at attach, we need to show "Enter Ctrl-C to enter REPL mode" or something like that (now it is not clear only hangs or connected without any messages).
I used rdbg -A for demonstrating the issue but usually we use it with VSCode. So ideally it should be set from the debuggee along with nonstop too.
We can consider separately with 'rdbg -A` and attach on VSCode (or not sure it should be same or not). For example, we can add another setting (like "nonstop": true) in launch.json.
But we always end up stopping at this place and then need to click continue multiple times.
At least, it should be one click.
Stop on attach:
We can see what kind of code are working at attach timing. It will help when the program seems hangs up.
We can use REPL immediately.
We can set breakpoints on running process with clicking on VSCode (and so on).
Other debuggers VS, gdb, lldb does this behavior, because maybe they need to setup breakpoints and so on for debugging.
Nonstop on attach:
Do not need to enter "c" for continue or continue button on the VSCode, and wait for the breakpoints.
This is default behavior of "launch" mode on VSCode (do not stop until breakpoints).
Could you check other debugger's (python, go, ...) attach behavior on VSCode?
(or I'll check)
There are another aspect: breakpoints (set by command or debugger method) should stop or not when the remote debugger client is not connected.
Now (1) it waits for client connection, but it is possible to (2) skip breakpoints if the client is not connected.
If we set debuggee's -n as nonstop at attach, I think (2) can be applied (I don't say it should be).
we need to show "Enter Ctrl-C to enter REPL mode" or something like that
👍 good call
Attach clients should setup nonstop:
I like the client configuration idea, but I think for users it'll be hard to understand the difference between server's nonstop and the client's nonstop. Perhaps a different name will be better, like --wait. It'll mean waiting for breakpoints to stop.
I also hope this behavior can also be configured on the server side, with something like RUBY_DEBUG_CLIENT_CONNECTION_STOP=false.
On the JavaScript with nodejs, I found interesting that it doesn't stop at debugger statement when client is not attached.
So NodeJS is one example of:
There are another aspect: breakpoints (set by command or debugger method) should stop or not when the remote debugger client is not connected.
Activity
ko1 commentedon Apr 22, 2022
This behavior is same as
gdb -p.It is useful to analyze what happens on the program.
Now non-stop flag is debuggee's flag.
rdbg -Ancan be more useful to control the behavior?st0012 commentedon Apr 23, 2022
I used
rdbg -Afor demonstrating the issue but usually we use it with VSCode. So ideally it should be set from the debuggee along withnonstoptoo.For the use cases I see (mostly attaching to a Rails server), I don't see much need for that. But it stopping at places like puma's internal (as shown above) is confusing and annoying.
Let me also explain how we use the debugger with our development tooling:
serverservice with debugger enabled:serverservice for developer server.binding.b) in code and restart theserverservice. (Most people are still used this way to add bps)And ideally, the server should run normally until we hit the breakpoint after reloading the page or making a request. But we always end up stopping at this place and then need to click
continuemultiple times.So IMO, it'd be great to make it optional and also non-default.
st0012 commentedon Apr 23, 2022
st0012 commentedon Apr 24, 2022
st0012 commentedon Apr 24, 2022
Ah the signal is always triggered by the debugger server itself (pause source). So which signal it uses doesn't matter for this issue.
This behavior seems to be introduced in bb5e5c3
[-]Unexpected stoppage by SIGURG signal[/-][+]Unexpected stoppage on remote debugging connection[/+]bfad commentedon Apr 29, 2022
For me, it also seems to lose the attached debugger sometimes on subsequent requests. The server would say "wait for debugger connection..." while the client debugger that was attached would be blocked waiting — even
ctrl-Cwould do nothing.ko1 commentedon Jul 6, 2022
I understand the scenario on #629 (comment).
If we do "nonstop" at attach, we need to show "Enter Ctrl-C to enter REPL mode" or something like that (now it is not clear only hangs or connected without any messages).
We can consider separately with 'rdbg -A` and attach on VSCode (or not sure it should be same or not). For example, we can add another setting (like "nonstop": true) in launch.json.
At least, it should be one click.
Could you check other debugger's (python, go, ...) attach behavior on VSCode?
(or I'll check)
There are another aspect: breakpoints (set by command or
debuggermethod) should stop or not when the remote debugger client is not connected.Now (1) it waits for client connection, but it is possible to (2) skip breakpoints if the client is not connected.
If we set debuggee's
-nas nonstop at attach, I think (2) can be applied (I don't say it should be).ko1 commentedon Jul 6, 2022
So I prefer:
rdbg -nA"nonstop": truein launch.json on VSCode attach configuration.I think the same default behavior with other debuggers is good, so it it is my current consideration.
st0012 commentedon Jul 7, 2022
👍 good call
I like the client configuration idea, but I think for users it'll be hard to understand the difference between server's nonstop and the client's nonstop. Perhaps a different name will be better, like
--wait. It'll mean waiting for breakpoints to stop.I also hope this behavior can also be configured on the server side, with something like
RUBY_DEBUG_CLIENT_CONNECTION_STOP=false.ko1 commentedon Jul 7, 2022
I checked the following GUI tool to attach and all of them do not stop the debuggee:
attachon RubyMine)So I changed my mind for nonstop on attaching with DAP.
On the CUI attachment, I confirmed that gcc/lldb/dlv (Golang) do stop at attach, so I remain the current behavior.
ko1 commentedon Jul 7, 2022
On the JavaScript with nodejs, I found interesting that it doesn't stop at
debuggerstatement when client is not attached.So NodeJS is one example of:
st0012 commentedon Jul 7, 2022
With nodejs's default debugger, the CUI doesn't stop at connection. It only stops when it hits the breakpoint.
Terminal1
Terminal2
Initially it'll be:
And when it hits the breakpoint, the source will be shown and the program will only stop then:
Does that mean DAP won't stop even without
-nspecified?ko1 commentedon Jul 7, 2022
yes.
Remove DAP's connection stoppage
st0012 commentedon Jul 7, 2022
@ko1 I've updated my PR to only skip DAP's connection stop.
nonstop at attach on DAP
nonstop at attach on DAP
nonstop at attach on DAP
nonstop at attach on DAP
make: fix the RBDG attach command
make: fix the RBDG attach command
make: fix the RBDG attach command
make: fix the RBDG attach command
make: fix the RBDG attach command
make: fix the RBDG attach command
make: fix the RBDG attach command