Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug: couldn't start dlv-dap #1693

Closed
hyangah opened this issue Aug 15, 2021 · 14 comments
Closed

Debug: couldn't start dlv-dap #1693

hyangah opened this issue Aug 15, 2021 · 14 comments
Assignees
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Aug 15, 2021

https://stackoverflow.com/questions/68753251/couldnt-start-dlv-dap

image

launch.json:

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Launch file",
        "type": "go",
        "request": "launch",
        "mode": "debug",
        "program": "${workspaceFolder}",
        "showLog": true,
        "env": {
            "GO111MODULE": "on"
        }
    }
]
}

I suspect the default timeout (5sec) is too short, or some other bug prevented the dlv dap server from starting:

If any of you encountered an issue, can you please try the following command and time how long it takes?

$ dlv-dap dap --listen=:12345 --log --log-output=dap
@gopherbot gopherbot added this to the Untriaged milestone Aug 15, 2021
@hyangah hyangah added Debug Issues related to the debugging functionality of the extension. DlvDAPDA WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 15, 2021
@miao233
Copy link

miao233 commented Aug 16, 2021

i have this issue as well

@miao233
Copy link

miao233 commented Aug 16, 2021

i have this issue as well

i have fixxed it but dlv-dap doesn't work

add this config into "setting.json"

"go.alternateTools": {
    "dlv": "dlv"
    },
    "go.delveConfig": {

        "dlvLoadConfig": {
            "followPointers": true,
            "maxVariableRecurse": 1,
            "maxStringLen": 64,
            "maxArrayValues": 64,
            "maxStructFields": -1
        },
        "apiVersion": 2,
        "showGlobalVariables": false,
        "debugAdapter": "legacy",
        "substitutePath": []
    }

but,command "dlv-dap dap --listen=:12345 --log --log-output=dap" doesn't work

@hyangah
Copy link
Contributor Author

hyangah commented Aug 16, 2021

@miao233 Please share what you see when you run "dlv-dap dap --listen=:12345 --log --log-output=dap". If you are using windows, find where your dlv-dap.exe is installed and run `dlv-dap.exe dap --listen=:12345 --log --log-output=dap"

@malaclypse
Copy link

I'm not the original poster, but since I also ran into this issue, I thought I'd comment here to follow.
I'm on Windows with the latest VSCode and Go, and since I also see this issue (but not all the time), I assume that the 5 second timeout is definitely too short, is there a good reason why it was set to 5 seconds specifically? Is there an easy way to increase it?

The output of the above command is fine, the DAP server starts successfully.

DAP server listening at: [::]:12345
2021-08-16T19:40:49+03:00 debug layer=dap DAP server pid = 24672

@hyangah
Copy link
Contributor Author

hyangah commented Aug 16, 2021

@malaclypse 5sec is arbitrarily chosen - the command (dlv dap) does not do anything significant other than starting a tcp server on the given port. Not sure what makes it to take such a long time in reasonably performant development environment. When you ran the command, did it take long time to see the output?

@momkeller
Copy link

@hyangah, i also run into this - vs code v1.59, go v1.16.7 - when i run the dlv dap command listed above manually, it takes about 14 seconds.

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/342632 mentions this issue: src/goDebugFactory: increase timeout for dlv dap server start

@miao233
Copy link

miao233 commented Aug 17, 2021

@hyangah i found the problem,cause firewall & safety-critical software had stopped dlv-dap on Windows with the latest VSCode and Go.i think maybe dlv-dap is new for windows? anyway,it work, it takes about 2 seconds.

@malaclypse
Copy link

@hyangah I see now that if I run start the server in a terminal outside of VSCode it's instantaneous, but it takes between 7 and 9 seconds inside the VSCode terminal, I'm honestly not sure what could be causing the discrepancy. I'm using the Windows Terminal app when outside of VSCode as my terminal, and it doesn't matter if I'm running it in CMD or a Powershell Core session (same for VSCode, in any shell it's much slower).

gopherbot pushed a commit that referenced this issue Aug 20, 2021
Some users are experiencing slow dlv dap server start.
The root cause of this slow start still needs investigation.

For #1693

Change-Id: Ie932bc2b9b7d273e0be2553b9fc154f2ae0b3ead
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/342632
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/345550 mentions this issue: [release] src/goDebugFactory: increase timeout for dlv dap server start

gopherbot pushed a commit that referenced this issue Aug 27, 2021
Some users are experiencing slow dlv dap server start.
The root cause of this slow start still needs investigation.

For #1693

Change-Id: Ie932bc2b9b7d273e0be2553b9fc154f2ae0b3ead
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/342632
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
(cherry picked from commit c79e0c4)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/345550
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Trust: Suzy Mueller <suzmue@golang.org>
@joelddiaz
Copy link

I'm seeing the same thing on VSCode on linux (Fedora 34 FWIW).

image

Running dlv-dap dap --listen=:12345 --log-output=dap --log is basically instantaneous:

[jdiaz@minigoomba ~]$ which dlv-dap
~/.gvm/pkgsets/go1.16.8/global/bin/dlv-dap
[jdiaz@minigoomba ~]$ dlv-dap dap --listen=:12345 --log-output=dap --log
DAP server listening at: [::]:12345
2021-09-17T14:11:46-04:00 debug layer=dap DAP server pid = 40275

If I start dlv-dap externally, and point my launch.conf to use the appropriate port 12345, then starting up the debug session from VSCode just hangs eternally (with no indication of a connection or anything from the log output from the dlv-dap terminal session).

My launch.conf (in case it is helpful):

{
            "name": "CloudCredOperator",
            "type": "go",
            //"debugAdapter": "legacy",
            "request": "launch",
            "mode": "auto",
            "remotePath": "",
            "port": 12345,
            "host": "127.0.0.1",
            "program": "${env:HOME}/projects/cloud-credential-operator/src/github.com/openshift/cloud-credential-operator/cmd/cloud-credential-operator/main.go",
            "env": {
                "KUBECONFIG": "/home/jdiaz/.kube/aws.kubeconfig",
                "CCO_SKIP_LEADER_ELECTION": "yes",
                "RELEASE_VERSION": "NEWTESTVER"
            },
            "args": [
                "operator"//,
                //"--log-level=debug"
            ],
            "showLog": true
        },

@hyangah hyangah self-assigned this Sep 20, 2021
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/351251 mentions this issue: package.json: add experimentalLogDestToStd for debugging dlv-dap launch issue

@hyangah
Copy link
Contributor Author

hyangah commented Feb 14, 2022

Is this still an issue?

  • We recently removed the use of dlv-dap, but started to use dlv. That will reduce the chance of firewall or security settings complaining about this unofficial binary dlv-dap.
  • Another suspect is the use of the file descriptor for --log-dest flag when starting the dlv dap server. If that is suspected, please try with "integratedTerminal" or "externalTerminal" as the console property in launch.json and report if that helps. That will start the dlv dap server without --log-dest arg & file descriptor.

And, other than these, I am currently out of ideas. :-(

@hyangah
Copy link
Contributor Author

hyangah commented Mar 8, 2022

Closing. The dlv-dap path had been default for a while and I don't see much activity here for a few months.
Please open a new issue if you have issues with the latest versions of the extension & delve, along with the information requested here
#1693 (comment)

@hyangah hyangah closed this as completed Mar 8, 2022
@golang golang locked and limited conversation to collaborators Mar 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debug Issues related to the debugging functionality of the extension. FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants