-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debugAdapter: Fix bugs that cause remote debug to hang
The issues being fixed in this PR: 1. There are instances where we are issuing a blocking call to Delve while it is running. That blocks subsequent requests to Delve and can cause the debugger to appear as hanged. Hence, we will need to check Delve's debug state before issuing blocking request in `stacktraceRequest` and `threadsRequest` (fixes #740). 2. When disconnecting, multiple requests `disconnectRequest` can be received. Subsequent `disconnectRequest` should not invoke Delve through the JSON RPC connection again as this may already be closed so we need to guard against that (fixes #766). 3. Also, even if Delve is blocked in `disconnectRequest`, `disconnectResponse` should always be sent back to VSCode after a period of time. Otherwise, in the case of Theia in particular, users will not be able to reset (fixes #761). 4. In `close` function of `Delve` class, we are not resolving a promise in the case of remote debugging and this causes the `close` function to hang and not send the `disconnectResponse` back (fixes #764). 5. Add more logging to help us easily debug similar scenarios in the future (fixes #763). ## Repro 1. Clones a Go program (for example: https://github.com/GoogleCloudPlatform/cloud-code-samples/tree/master/golang/go-hello-world). 2. Runs the program in Delve through a terminal: `dlv debug --continue --accept-multiclient --api-version=2 --headless --listen=:3456 --log` 3. Connect to it by creating a configuration: ``` { "name": "Connect to server", "type": "go", "request": "attach", "mode": "remote", "remotePath": "${workspaceFolder}", "port": 3456, "host": "127.0.0.1", "cwd": "${workspaceFolder}" } ``` 4. Sets a breakpoint and sees that it's not working. 5. Disconnecting also does not work. Change-Id: Iaa385c392326f489a9ec0e804d2c2bce6cc3defe GitHub-Last-Rev: e052642 GitHub-Pull-Request: #686 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/257337 Trust: Quoc Truong <[email protected]> Reviewed-by: Polina Sokolova <[email protected]>
- Loading branch information
1 parent
c17c69f
commit d2fbb62
Showing
1 changed file
with
109 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters