delve icon indicating copy to clipboard operation
delve copied to clipboard

Debugger hangs when debugging with breakpoints

Open kushicp opened this issue 10 months ago • 4 comments

When a test case with breakpoints in code or test case the itself, is executed, below error is thrown in logs and the test case execution hangs forever.

org.jetbrains.concurrency.MessageError: Internal debugger error: <nil> not a String
runtime.gopanic (0x43cdf1)
	/mnt/agent/temp/buildTmp/go/src/runtime/panic.go:770
go/constant.StringVal (0x6173e4)
	/mnt/agent/temp/buildTmp/go/src/go/constant/value.go:500
github.com/go-delve/delve/pkg/proc.(*G).Labels (0x8436f9)
	/mnt/agent/work/4c3e5e3eabfaf2d2/pkg/proc/variables.go:594
github.com/go-delve/delve/service/api.ConvertGoroutine (0x8650d8)
	/mnt/agent/work/4c3e5e3eabfaf2d2/service/api/conversions.go:309
github.com/go-delve/delve/service/debugger.(*Debugger).state (0x8fc0b7)
	/mnt/agent/work/4c3e5e3eabfaf2d2/service/debugger/debugger.go:586
github.com/go-delve/delve/service/debugger.(*Debugger).Command (0x9017cc)
	/mnt/agent/work/4c3e5e3eabfaf2d2/service/debugger/debugger.go:1219
github.com/go-delve/delve/service/rpc2.(*RPCServer).Command (0xa4db1c)
	/mnt/agent/work/4c3e5e3eabfaf2d2/service/rpc2/server.go:130
reflect.Value.call (0x4e3f45)
	/mnt/agent/temp/buildTmp/go/src/reflect/value.go:596
reflect.Value.Call (0x4e3058)
	/mnt/agent/temp/buildTmp/go/src/reflect/value.go:380
github.com/go-delve/delve/service/rpccommon.(*ServerImpl).serveJSONCodec.func3 (0xb3d314)
	/mnt/agent/work/4c3e5e3eabfaf2d2/service/rpccommon/server.go:369
runtime.goexit (0x4736c0)
	/mnt/agent/temp/buildTmp/go/src/runtime/asm_amd64.s:1695

The issue can be seen in Intellij IDEA and VSCode, latest versions. Below are the versions used,

GO version - v1.24.0 Delve version - v1.24.0

kushicp avatar Mar 04 '25 22:03 kushicp

Do you have a way that we can reproduce this problem?

aarzilli avatar Mar 05 '25 11:03 aarzilli

Hi @aarzilli,

Steps to reproduce,

  1. Create a go test case
  2. Set debug points
  3. Debug the test case

Expected result Able to debug successfully with control stopping at breakpoints

Actual Result: Execution hangs with control never arriving at the breakpoint

kushicp avatar Mar 05 '25 14:03 kushicp

It doesn't happen. I don't see how it could happen in that case given that it's an error that can only happen while reading goroutine labels and a bare test case won't have any.

aarzilli avatar Mar 05 '25 14:03 aarzilli

Hi, @aarzilli , I also got this error. To reproduce it:

Environment

  • OS: Darwin arm64
  • Delve: v1.24.0+
  • Go: v1.24.0+

Step

Run any debug session on the https://github.com/timandy/routine/tree/v1.1.4 repository that will invoke the setLabels: https://github.com/timandy/routine/blob/v1.1.4/goid.go#L49

For example, debug this test function and set breakpoint at setLabels

You will find the debug session gets stuck, after click the Stop, IDE throw this panic:

org.jetbrains.concurrency.MessageError: Internal debugger error: <nil> not a String
runtime.gopanic (0x102419cf3)
	/opt/teamcity-agent/temp/buildTmp/go/src/runtime/panic.go:770
go/constant.StringVal (0x1025e07e3)
	/opt/teamcity-agent/temp/buildTmp/go/src/go/constant/value.go:500
github.com/go-delve/delve/pkg/proc.(*G).Labels (0x10278d82b)
	/opt/teamcity-agent/work/4c3e5e3eabfaf2d2/pkg/proc/variables.go:594
...

hongyuh-hh avatar Mar 29 '25 01:03 hongyuh-hh

Fixed by #3968

aarzilli avatar Sep 02 '25 15:09 aarzilli