Skip to content

x/sync/errgroup: no trace info is shown when nil pointer dereference occurs #73710

Closed
@hajimehoshi

Description

@hajimehoshi

Go version

go version go1.24.3 darwin/arm64

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/hajimehoshi/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/hajimehoshi/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/cj/73zbb35j0qx5t4b6rnqq0__h0000gn/T/go-build2637291888=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/hajimehoshi/rpgsnack/runtime/go.mod'
GOMODCACHE='/Users/hajimehoshi/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/hajimehoshi/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/Users/hajimehoshi/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.3'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

Run this with golang.org/x/sync v0.14.0 (https://go.dev/play/p/MWWuvzsPYXs)

package main

import (
	"fmt"

	"golang.org/x/sync/errgroup"
)

func main() {
	var g errgroup.Group
	var x *int
	g.Go(func() error {
		*x = 1
		return nil
	})
	if err := g.Wait(); err != nil {
		fmt.Printf("%#v", err)
	}
}

What did you see happen?

panic: recovered from errgroup.Group: runtime error: invalid memory address or nil pointer dereference

goroutine 1 [running]:
golang.org/x/sync/errgroup.(*Group).Wait(0xc00006a1e0)
	/tmp/gopath3257435728/pkg/mod/golang.org/x/sync@v0.14.0/errgroup/errgroup.go:70 +0x6d
main.main()
	/tmp/sandbox1006481412/prog.go:16 +0x85

and this doesn't tell where this dereference occurs

What did you expect to see?

In v0.13.0 (https://go.dev/play/p/k7rMoNy82F0) there was an info to know that

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x493264]

goroutine 6 [running]:
main.main.func1()
	/tmp/sandbox193375590/prog.go:13 +0x4
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/tmp/gopath784252627/pkg/mod/golang.org/x/sync@v0.13.0/errgroup/errgroup.go:79 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
	/tmp/gopath784252627/pkg/mod/golang.org/x/sync@v0.13.0/errgroup/errgroup.go:76 +0x93

Related: #53757

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions