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

dlv --continue does not work in docker #3871

Open
lukatendai opened this issue Dec 2, 2024 · 6 comments
Open

dlv --continue does not work in docker #3871

lukatendai opened this issue Dec 2, 2024 · 6 comments

Comments

@lukatendai
Copy link

I am running my program in a docker container:

/bin/dlv --headless=true --continue --accept-multiclient --listen=:5432 --api-version=2 exec test -- api-server -a 0.0.0.0:8883 --v 5 --log os:///stderr -w TRUE

When I use vscode and try to debug, nothing happens. However, when I remove option --continue, I can successfully debug

  1. What version of Delve are you using (dlv version)? Version: 1.23.1
  2. What version of Go are you using? (go version)? go version go1.23.3 darwin/arm64
  3. What operating system and processor architecture are you using? MacOS M3
  4. What did you do? Trying to debug
  5. What did you expect to see? Process starts and I can stop at. breakpoint
  6. What did you see instead? process starts and never stops at the breakpoint
@aarzilli
Copy link
Member

aarzilli commented Dec 3, 2024

What do the logs say? You say "process starts and never stops at the breakpoint" but what breakpoint should it stop at? You didn't set any.

@lukatendai
Copy link
Author

2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc serving JSON-RPC on new connection 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc <- RPCServer.GetVersion(api.GetVersionIn{}) 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc -> *api.GetVersionOut{"DelveVersion":"Version: 1.23.1\nBuild: $Id: 2eba762d75437d380e48fc42213853f13aa2904d $","APIVersion":2,"Backend":"native","TargetGoVersion":"","MinSupportedVersionOfGo":"1.21.0","MaxSupportedVersionOfGo":"1.23.0"} error: "" 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 2) <- RPCServer.State(rpc2.StateIn{"NonBlocking":true}) 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 2) -> rpc2.StateOut{"State":{"Pid":0,"TargetCommandLine":"","Running":true,"Recording":false,"CoreDumping":false,"Threads":null,"NextInProgress":false,"WatchOutOfScope":null,"exited":false,"exitStatus":0,"When":""}} error: "" 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 3) <- RPCServer.State(rpc2.StateIn{"NonBlocking":true}) 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 3) -> rpc2.StateOut{"State":{"Pid":0,"TargetCommandLine":"","Running":true,"Recording":false,"CoreDumping":false,"Threads":null,"NextInProgress":false,"WatchOutOfScope":null,"exited":false,"exitStatus":0,"When":""}} error: "" 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 4) <- RPCServer.State(rpc2.StateIn{"NonBlocking":true}) 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 4) -> rpc2.StateOut{"State":{"Pid":0,"TargetCommandLine":"","Running":true,"Recording":false,"CoreDumping":false,"Threads":null,"NextInProgress":false,"WatchOutOfScope":null,"exited":false,"exitStatus":0,"When":""}} error: "" 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 5) <- RPCServer.State(rpc2.StateIn{"NonBlocking":true}) 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 5) -> rpc2.StateOut{"State":{"Pid":0,"TargetCommandLine":"","Running":true,"Recording":false,"CoreDumping":false,"Threads":null,"NextInProgress":false,"WatchOutOfScope":null,"exited":false,"exitStatus":0,"When":""}} error: "" 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 6) <- RPCServer.Command(api.DebuggerCommand{"name":"halt","ReturnInfoLoadConfig":null}) 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 15) -> rpc2.CommandOut{"State":{"Pid":13,"TargetCommandLine":"/bg/fs/bin/gobg api-server -a 0.0.0.0:8883 --v 5 --log os:///stderr -w TRUE","Running":false,"Recording":false,"CoreDumping":false,"currentThread":{"id":13,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},"Threads":[{"id":25,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":27,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":28,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":29,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":30,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":34,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":13,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":23,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":24,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":26,"pc":616928,"file":"/usr/local/go/src/internal/runtime/syscall/asm_linux_arm64.s","line":17,"function":{"name":"internal/runtime/syscall.Syscall6","value":616896,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":31,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false},{"id":32,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":54,"ReturnValues":null,"CallReturn":false},{"id":33,"pc":591052,"file":"/usr/local/go/src/runtime/sys_linux_arm64.s","line":651,"function":{"name":"runtime.futex","value":591024,"type":0,"goType":0,"optimized":true},"goroutineID":0,"ReturnValues":null,"CallReturn":false}],"NextInProgress":false,"WatchOutOfScope":null,"exited":false,"exitStatus":0,"When":""}} error: "" 2024-12-05 14:06:13 2024-12-05T19:06:13Z debug layer=rpc (async 17) <- RPCServer.Command(api.DebuggerCommand{"name":"continue","ReturnInfoLoadConfig":null})

@lukatendai
Copy link
Author

This is a log from my docker after I started debugging, after that nothing happens. When I try to pause, it does nothing, no logs at all

@aarzilli
Copy link
Member

aarzilli commented Dec 5, 2024

Please describe what you did to get that log and why you would expect something to happen.

@lukatendai
Copy link
Author

  1. I have a docker compose setup to run following command: /bin/dlv --headless=true --continue --accept-multiclient --listen=:5432 --api-version=2 exec test -- api-server -a 0.0.0.0:8883 --v 5 --log os:///stderr -w TRUE\
  2. I start docker, i can see that mine container is running
  3. I go to VSCode and I run a debugger which connects to the port exported by the container
  4. The debugger shows the debugger toolbar with "pause", "refresh" and "disconnect" buttons.
  5. When I click "pause" I expect that my program that runs in the container to stop and to see the call stack, Instead nothing happens.

Here is the thing, when I remove "--continue" from the docker command, the program stops and waits for the debugger to connect, and then when I click "pause" the program stops and I see the call stack.

@aarzilli
Copy link
Member

aarzilli commented Dec 5, 2024

This might simply be the legacy mode of the debug adapter not supporting --continue, try switching to dlv-dap: https://github.com/golang/vscode-go/wiki/debugging#connect-to-headless-delve-with-target-specified-at-server-start-up

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

No branches or pull requests

2 participants