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

Delve DAP server is abruptly disconnecting #101

Closed
trevorwhitney opened this issue Oct 8, 2024 · 2 comments
Closed

Delve DAP server is abruptly disconnecting #101

trevorwhitney opened this issue Oct 8, 2024 · 2 comments

Comments

@trevorwhitney
Copy link

I have been using this plugin for years without problems. Recently when I try to run anything via delve, the DAP server seems to be abruptly disconnecting.

I'm on Mac OS 15.0.1, using go 1.23.2 and delve 1.23.1 here's all the debug info I can manage to get it to spit out

[debug-adapter stderr] 2024-10-08T14:38:50-06:00 debug layer=dap DAP connection 1 started
2024-10-08T14:38:50-06:00 debug layer=dap [<- from client]{"seq":1,"type":"request","command":"initialize","arguments":{"clientID":"neovim","clientName":"neovim","adapterID":"nvim-dap","locale":"en_US.UTF-8","linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path","supportsVariableType":true,"supportsRunInTerminalRequest":true,"supportsProgressReporting":true,"supportsStartDebuggingRequest":true}}
2024-10-08T14:38:50-06:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":true,"supportsConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"supportsSetVariable":true,"supportsExceptionInfoRequest":true,"supportsDelayedStackTraceLoading":true,"supportsLogPoints":true,"supportsDisassembleRequest":true,"supportsClipboardContext":true,"supportsSteppingGranularity":true,"supportsInstructionBreakpoints":true}}

[debug-adapter stderr] 2024-10-08T14:38:50-06:00 debug layer=dap [<- from client]{"seq":2,"type":"request","command":"launch","arguments":{"args":["-config.file=\/Users\/twhitney\/workspace\/loki\/cmd\/loki\/loki-local-config.yaml"],"request":"launch","program":"\/Users\/twhitney\/workspace\/loki\/cmd\/loki\/main.go","name":"Debug (Arguments)","type":"go","buildFlags":""}}
2024-10-08T14:38:50-06:00 debug layer=dap parsed launch config: {
	"mode": "debug",
	"program": "/Users/twhitney/workspace/loki/cmd/loki/main.go",
	"args": [
		"-config.file=/Users/twhitney/workspace/loki/cmd/loki/loki-local-config.yaml"
	],
	"buildFlags": {},
	"backend": "default",
	"stackTraceDepth": 50
}

[debug-adapter stderr] 2024-10-08T14:38:57-06:00 debug layer=dap building from "/Users/twhitney/workspace/loki": [go build -o /Users/twhitney/workspace/loki/__debug_bin4138714687 -gcflags all=-N -l /Users/twhitney/workspace/loki/cmd/loki/main.go]

[debug-adapter stderr] 2024-10-08T14:38:57-06:00 debug layer=dap launching binary '/Users/twhitney/workspace/loki/__debug_bin4138714687' with config: {
	"mode": "debug",
	"program": "/Users/twhitney/workspace/loki/cmd/loki/main.go",
	"args": [
		"-config.file=/Users/twhitney/workspace/loki/cmd/loki/loki-local-config.yaml"
	],
	"cwd": "/Users/twhitney/workspace/loki",
	"buildFlags": {},
	"output": "/Users/twhitney/workspace/loki/__debug_bin4138714687",
	"dlvCwd": "/Users/twhitney/workspace/loki",
	"backend": "default",
	"stackTraceDepth": 50
}

[debug-adapter stderr] 2024-10-08T14:38:57-06:00 info layer=debugger launching process with args: [/Users/twhitney/workspace/loki/__debug_bin4138714687 -config.file=/Users/twhitney/workspace/loki/cmd/loki/loki-local-config.yaml]

[debug-adapter stderr] 2024-10-08T14:38:58-06:00 debug layer=debugger entryPoint 0x100aa0000 machoOff 0x100000000

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 warning layer=debugger debug_frame workaround not applied: function internal/abi.(*RegArgs).Dump (at 0x100aa1070) covered by 0x100aa1070-0x100aa1230

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 debug layer=debugger Adding target 65025 "/Users/twhitney/workspace/loki/__debug_bin4138714687 -config.file=/Users/twhitney/workspace/loki/cmd/loki/loki-local-config.yaml"

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 debug layer=dap [-> to client]{"seq":0,"type":"event","event":"initialized"}
2024-10-08T14:38:59-06:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":2,"success":true,"command":"launch"}

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 debug layer=dap [<- from client]{"seq":3,"type":"request","command":"configurationDone"}

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 debug layer=dap [-> to client]{"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Type 'dlv help' for list of commands.\n"}}

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":3,"success":true,"command":"configurationDone"}
Type 'dlv help' for list of commands.

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 debug layer=debugger continuing
2024-10-08T14:38:59-06:00 debug layer=debugger ContinueOnce

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 debug layer=dap [-> to client]{"seq":0,"type":"event","event":"terminated","body":{}}

[debug-adapter stderr] 2024-10-08T14:38:59-06:00 debug layer=dap DAP server stopping...
2024-10-08T14:38:59-06:00 debug layer=dap halting
2024-10-08T14:38:59-06:00 debug layer=dap process not running
2024-10-08T14:38:59-06:00 debug layer=dap [-> to client]{"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Process 65025 has exited with status 11\n"}}
2024-10-08T14:38:59-06:00 debug layer=dap [-> to client]{"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Detaching\n"}}
2024-10-08T14:38:59-06:00 debug layer=debugger detaching
2024-10-08T14:38:59-06:00 debug layer=dap DAP error: read tcp 127.0.0.1:51432->127.0.0.1:51434: use of closed network connection
2024-10-08T14:38:59-06:00 debug layer=dap DAP server stopped

and the dap.log

[ DEBUG ] 2024-10-08T14:38:50Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1229 ]        "Starting debug adapter server executable"      {
  args = { "dap", "-l", "127.0.0.1:51432", "--log", "--log-output=dap,debugger" },
  command = "dlv",
  detached = true
}
[ DEBUG ] 2024-10-08T14:38:50Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1362 ]        "Debug adapter server executable started, listening on 51432"
[ DEBUG ] 2024-10-08T14:38:50Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1366 ]        "Connecting to debug adapter"   {
  executable = {
    args = { "dap", "-l", "127.0.0.1:51432", "--log", "--log-output=dap,debugger" },
    command = "dlv",
    detached = true
  },
  options = {
    initialize_timeout_sec = 20
  },
  port = 51432,
  type = "server"
}
[ DEBUG ] 2024-10-08T14:38:50Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1746 ]        "request"       {
  arguments = {
    adapterID = "nvim-dap",
    clientID = "neovim",
    clientName = "neovim",
    columnsStartAt1 = true,
    linesStartAt1 = true,
    locale = "en_US.UTF-8",
    pathFormat = "path",
    supportsProgressReporting = true,
    supportsRunInTerminalRequest = true,
    supportsStartDebuggingRequest = true,
    supportsVariableType = true
  },
  command = "initialize",
  seq = 1,
  type = "request"
}
[ DEBUG ] 2024-10-08T14:38:50Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1013 ]        1       {
  body = {
    supportsClipboardContext = true,
    supportsConditionalBreakpoints = true,
    supportsConfigurationDoneRequest = true,
    supportsDelayedStackTraceLoading = true,
    supportsDisassembleRequest = true,
    supportsEvaluateForHovers = true,
    supportsExceptionInfoRequest = true,
    supportsFunctionBreakpoints = true,
    supportsInstructionBreakpoints = true,
    supportsLogPoints = true,
    supportsSetVariable = true,
    supportsSteppingGranularity = true
  },
  command = "initialize",
  request_seq = 1,
  seq = 0,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-10-08T14:38:50Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1746 ]        "request"       {
  arguments = {
    args = { "-config.file=/Users/twhitney/workspace/loki/cmd/loki/loki-local-config.yaml" },
    buildFlags = "",
    name = "Debug (Arguments)",
    program = "/Users/twhitney/workspace/loki/cmd/loki/main.go",
    request = "launch",
    type = "go"
  },
  command = "launch",
  seq = 2,
  type = "request"
}
[ DEBUG ] 2024-10-08T14:38:59Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1013 ]        1       {
  event = "initialized",
  seq = 0,
  type = "event"
}
[ DEBUG ] 2024-10-08T14:38:59Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1013 ]        1       {
  command = "launch",
  request_seq = 2,
  seq = 0,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-10-08T14:38:59Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1746 ]        "request"       {
  command = "configurationDone",
  seq = 3,
  type = "request"
}
[ DEBUG ] 2024-10-08T14:38:59Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1013 ]        1       {
  body = {
    category = "console",
    output = "Type 'dlv help' for list of commands.\n"
  },
  event = "output",
  seq = 0,
  type = "event"
}
[ DEBUG ] 2024-10-08T14:38:59Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1013 ]        1       {
  command = "configurationDone",
  request_seq = 3,
  seq = 0,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-10-08T14:38:59Z-0600 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:1013 ]        1       {
  body = vim.empty_dict(),
  event = "terminated",
  seq = 0,
  type = "event"
}

Do you have any idea what might be wrong, or other troubleshooting ideas?

@leoluz
Copy link
Owner

leoluz commented Oct 17, 2024

I am not sure but it seems to be using this config file: /Users/twhitney/workspace/loki/cmd/loki/loki-local-config.yaml
Is this vscode configuration? Have you intentionally configured this plugin to be configured this way? I would try to move this config file out of your workspace and give it a try.

@trevorwhitney
Copy link
Author

sorry, I should have updated this issue.

the problem ended up being a dependency in our project that removed cgo: go-delve/delve#3825

the config file there is meant to be a command line arg, ie -config.file=loki-local-config.yaml, as the main() I'm trying to debug requires a config. Once I downgraded the dependency everyone worked as normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants