-
Notifications
You must be signed in to change notification settings - Fork 645
Breakpoints added when debug session is not in a paused state, results in debug process not ending #2002
Comments
Can you provide a small sample code where I can try to reproduce this issue? |
I followed all the steps as in the video on the sample code, but I dont see the same error. Can you share your set up information? OS, VS Code version, Go version and the Go extension version. |
I have provided version information in the first comment:
|
Thanks @yinfxs I see this on Mac, but on Windows. |
Thanks. |
Can confirm the exact same behavior on
The problem only occurs if one adds/removes breakpoints during a debug-session. |
I also see this on all current versions:
|
I'm having the same problem right now on mac, first time testing delve with go extension and after hitting the stop button the debug process is still alive |
@yinfxs I am trying to reproduce this issue again with your sample code, but the video in your comment is no longer available (its just a snapshot now). Can you re-share the steps?
@bihe Adding a breakpoint is only possible either before a debug session starts or when another breakpoint is hit. Are you seeing this issue when trying to add a breakpoint when another breakpoint is hit or when the program is running? @ericpitcher, @mbanzon If you are seeing this issue with the sample code @yinfxs has shared in |
@ramya-rao-a I have used the godoc example of a http handler as the testing-code (https://golang.org/pkg/net/http/#example_ListenAndServe). Using this I can reproduce/show the behavior. The process only hangs if I change breakpoints "outside" of debug sessions.
I've created a video showing the behavior above: If I change the breakpoint only during a active debug session the behavior is normal/expected.
Again short video shwoing this behavior:
If this is the case (the example above shows it) I was not really aware of this. I could not find anything in the docs (https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code). Compared with the debugging experience of other vscode extensions (e.g. omnisharp-vscode) this is a rather non-standard-behavior. Update of my environment:
|
Thanks for the details @bihe. The issue of breakpoints getting added successfully only before a debug session or when another breakpoint is hit is a limitation on delve's side which doesn't allow interacting with the target process when it is running. You are right, this isn't documented well even though it has come up multiple times as issues in this repo. I have updated the wiki on debugging Go code with this extension appropriately The fact that the debug process itself doesn't get cleaned up properly and so further debug sessions fail due to the "listen tcp :8080: bind: address already in use" is an issue that we can look into. |
This description matches what I am seeing as well. I have tried on macOS (latest, 10.14.1) and Windows 10 - it is only on macOS I see the error where the process is kept hanging. |
I am a little pressed for time at the moment. If anyone is interested in investigating the cause for the debug process not ending properly, here are a few pointers
|
I added the trace: verbose. What I have found is that if I create the breakpoints before I launch debugging, then debugging works, the breakpoints are hit and when I hit stop the debug process is killed. It is when I click to launch debugging with no breakpoints in place and I add them afterward is when they are not hit and when I click on the stop button the debug process does not get killed. I have the debug log for each case below, I perform the same debug steps in each case below, refresh the browser only once to trigger breakpoint on web server response, then I stop debugging, again only difference is at what point breakpoints are added. This is the code I am debugging https://github.com/ericpitcher/go-vs-code-debugging When debugging is failing, breakpoints not hit, debug process does not die when stopped - Breakpoints are created after debug launch
When debugging is successful, breakpoints are hit, debug process does die when stopped - Breakpoints are created before debug launch
|
Thanks @ericpitcher! From your logs its clear that the call to delve to create the breakpoint at https://github.com/Microsoft/vscode-go/blob/latest/src/debugAdapter/goDebug.ts#L722 never actually returns. I guess at this point, any further requests to delve doesnt get responded to which is why the eventual Halt request doesnt reach it and so it is unable to gracefully close the program. We have #2128 to fix the issue of adding breakpoints when the program is running. Once that fix is in, we shouldnt be having this issue anymore. |
@ramya-rao-a Great thanks a lot! Let me know if you want me to test anything else out on my Mac. |
Steps to Reproduce:
Every time I add a new breakpoint, the process will not be killed after restarting the debug.
macOS 10.13.6
vscode 1.28.0
vscode-go 0.6.91.
The text was updated successfully, but these errors were encountered: