Skip to content

bad defer entry in panic with panic in defer #61059

Closed
@stoksc

Description

@stoksc

What version of Go are you using (go version)?

$ go version
go version go1.20.5 darwin/arm64

Does this issue reproduce with the latest release?

Yes, I saw it on the 1.21 rc version, too.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/*/Library/Caches/go-build"
GOENV="/Users/*/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/*/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/*/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/*/*/*/master/go.mod"
GOWORK="/Users/*/*/*/go.work"
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/jz/mf6cdns11jx9prqj65v8rjx40000gp/T/go-build2673756243=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I have a complicated code base so it is hard to pin down, but if I get a minimal repro I will update this issue. Within this code base, I have a 'hang' where execution abruptly stops because a function never returns but it also doesn't panic. I can print from a defer call at the top of a function call but not from the line after the function returns. When I attach a debugger, it ends at this line in panic.go:

if gp._defer != d {
	throw("bad defer entry in panic")
}

After which I get no panic or stderr, execution just seems to stop. I do have a panic in a defer. When I fix it everything works fine.

What did you expect to see?

A panic, I think.

What did you see instead?

Nothing, a halt.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions