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

cmd/compile: nil dereference when storing field of non-nil struct value #71857

Open
chenjie199234 opened this issue Feb 20, 2025 · 15 comments
Open
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@chenjie199234
Copy link

chenjie199234 commented Feb 20, 2025

Go version

1.24.0

go env
set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=1
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
go: stripping unprintable or unescapable characters from %"GOBIN"%
set GOBIN=C:\Users\������\Desktop\Go\bin
go: stripping unprintable or unescapable characters from %"GOCACHE"%
set GOCACHE=C:\Users\������\Desktop\Go\cache
set GOCACHEPROG=
set GODEBUG=
go: stripping unprintable or unescapable characters from %"GOENV"%
set GOENV=C:\Users\������\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
go: stripping unprintable or unescapable characters from %"GOGCCFLAGS"%
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\������\AppData\Local\Temp\go-build2224281176=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
go: stripping unprintable or unescapable characters from %"GOMOD"%
set GOMOD=C:\Users\������\Desktop\project\gate\go.mod
go: stripping unprintable or unescapable characters from %"GOMODCACHE"%
set GOMODCACHE=C:\Users\������\Desktop\Go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
go: stripping unprintable or unescapable characters from %"GOPATH"%
set GOPATH=C:\Users\������\Desktop\Go
set GOPRIVATE=
set GOPROXY=direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=off
set GOTELEMETRY=local
go: stripping unprintable or unescapable characters from %"GOTELEMETRYDIR"%
set GOTELEMETRYDIR=C:\Users\������\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.24.0
go: stripping unprintable or unescapable characters from %"GOWORK"%
set GOWORK=C:\Users\������\Desktop\project\go.work
set PKG_CONFIG=pkg-config

What did you do?

in my project,there has a very strange panic when update from 1.23.6 to 1.24.0
my project is a little bit complex and i don't known how to reproduce it in simple code
i just don't known why it can happen,so i don't known how to start to reproduce it.
the code works fine in 1.23.6,please give me some clue,what changed in 1.24.0 may cause this panic

here is the demo's main.go
package main

import (
"bytes"
"context"
"log/slog"
"time"

"github.com/chenjie199234/Corelib/crpc"
"github.com/chenjie199234/Corelib/discover"
"github.com/chenjie199234/Corelib/util/name"

)

func main() {
name.SetSelfFullName("p", "g", "test")
go func() {
s, e := crpc.NewCrpcServer(&crpc.ServerConfig{}, nil)
if e != nil {
panic(e)
}
s.RegisterHandler("sname", "mname", func(ctx *crpc.ServerContext) {
data, e := ctx.Recv()
if e != nil {
panic(e)
}
if e := ctx.Send(data); e != nil {
panic(e)
}
slog.Info("server handle success")
})
if e := s.StartCrpcServer(":12345"); e != nil && e != crpc.ErrServerClosed {
panic(e)
}
}()
time.Sleep(time.Second)
di, e := discover.NewStaticDiscover("p", "g", "test", []string{"127.0.0.1"}, 12345, 0, 0)
if e != nil {
panic(e)
}
c, e := crpc.NewCrpcClient(&crpc.ClientConfig{}, di, "p", "g", "test", nil)
if e != nil {
panic(e)
}
c.Call(context.Background(), "/sname/mname", []byte("lalala"), func(ctx *crpc.CallContext) error {
data, e := ctx.Recv()
if e != nil {
panic(e)
}
if !bytes.Equal(data, []byte("lalala")) {
panic("data broken")
}
slog.Info("client call success")
return nil
})
}

here is the demo's go.mod
module demo

go 1.23.0

require github.com/chenjie199234/Corelib v0.0.133-0.20250221101755-b7a3a9d25afa

here is the compare between 1.23.6 and 1.24.0
PS C:\Users\陈杰\Desktop\Go\demo5> go version
go version go1.23.6 windows/amd64
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:21:48 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:21:48 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:21:48 INFO server handle success
2025/02/21 18:21:48 INFO client call success
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:21:54 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:21:54 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:21:54 INFO server handle success
2025/02/21 18:21:54 INFO client call success
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:22:00 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:22:00 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:22:00 INFO server handle success
2025/02/21 18:22:00 INFO client call success
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:22:05 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:22:05 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:22:05 INFO server handle success
2025/02/21 18:22:05 INFO client call success
PS C:\Users\陈杰\Desktop\Go\demo5> go env
set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=1
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
go: stripping unprintable or unescapable characters from %"GOBIN"%
set GOBIN=C:\Users\������\Desktop\Go\bin
go: stripping unprintable or unescapable characters from %"GOCACHE"%
set GOCACHE=C:\Users\������\Desktop\Go\cache
set GOCACHEPROG=
set GODEBUG=
go: stripping unprintable or unescapable characters from %"GOENV"%
set GOENV=C:\Users\������\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
go: stripping unprintable or unescapable characters from %"GOGCCFLAGS"%
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\������\AppData\Local\Temp\go-build4256688942=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
go: stripping unprintable or unescapable characters from %"GOMOD"%
set GOMOD=C:\Users\������\Desktop\Go\demo5\go.mod
go: stripping unprintable or unescapable characters from %"GOMODCACHE"%
set GOMODCACHE=C:\Users\������\Desktop\Go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
go: stripping unprintable or unescapable characters from %"GOPATH"%
set GOPATH=C:\Users\������\Desktop\Go
set GOPRIVATE=
set GOPROXY=direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=off
set GOTELEMETRY=local
go: stripping unprintable or unescapable characters from %"GOTELEMETRYDIR"%
set GOTELEMETRYDIR=C:\Users\������\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.24.0
set GOWORK=
set PKG_CONFIG=pkg-config
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:29:26 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:29:26 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:29:26 INFO server handle success
2025/02/21 18:29:26 INFO client call success
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x54 pc=0x12f7e07]

goroutine 24 [running]:
github.com/chenjie199234/Corelib/crpc.(*rw).closerecvsend(0xc000046db0?, 0xbc?, {0x0?, 0x0?})
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/rw.go:109 +0x47
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2.1()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:416 +0x458
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:426 +0x127
created by github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc in goroutine 23
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:390 +0x23f9
exit status 2
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:29:31 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:29:31 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:29:31 INFO server handle success
2025/02/21 18:29:31 INFO client call success
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x54 pc=0x1f27e07]

goroutine 69 [running]:
github.com/chenjie199234/Corelib/crpc.(*rw).closerecvsend(0xc00074c420?, 0x80?, {0x0?, 0x0?})
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/rw.go:109 +0x47
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2.1()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:416 +0x458
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:426 +0x127
created by github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc in goroutine 68
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:390 +0x23f9
exit status 2
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:29:35 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:29:35 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:29:35 INFO server handle success
2025/02/21 18:29:35 INFO client call success
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x54 pc=0x1f27e07]

goroutine 48 [running]:
github.com/chenjie199234/Corelib/crpc.(*rw).closerecvsend(0xc00010b830?, 0x28?, {0x0?, 0x0?})
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/rw.go:109 +0x47
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2.1()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:416 +0x458
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:426 +0x127
created by github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc in goroutine 47
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:390 +0x23f9
exit status 2
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:29:39 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:29:39 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:29:39 INFO server handle success
2025/02/21 18:29:39 INFO client call success
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x54 pc=0x1f27e07]

goroutine 77 [running]:
github.com/chenjie199234/Corelib/crpc.(*rw).closerecvsend(0xc000682ba0?, 0xc4?, {0x0?, 0x0?})
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/rw.go:109 +0x47
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2.1()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:416 +0x458
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:426 +0x127
created by github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc in goroutine 76
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:390 +0x23f9
exit status 2

I also find some strange thing

  1. in version 1.24.0,if i run with -race,the panic gone,but there has no race output
here is the output
PS C:\Users\陈杰\Desktop\Go\demo5> go run -race .\main.go
2025/02/21 18:52:02 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:52:02 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:52:02 INFO server handle success
2025/02/21 18:52:02 INFO client call success
PS C:\Users\陈杰\Desktop\Go\demo5> go run -race .\main.go
2025/02/21 18:52:07 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:52:07 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:52:07 INFO server handle success
2025/02/21 18:52:07 INFO client call success
PS C:\Users\陈杰\Desktop\Go\demo5> go run -race .\main.go
2025/02/21 18:52:11 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:52:11 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:52:11 INFO server handle success
2025/02/21 18:52:11 INFO client call success
PS C:\Users\陈杰\Desktop\Go\demo5> go run -race .\main.go
2025/02/21 18:52:15 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:52:15 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:52:15 INFO server handle success
2025/02/21 18:52:15 INFO client call success
  1. in version 1.24.0,if i add the println(this) to print the struct's addr,it shows the addr is 0xc,and every time is this addr
here is the log
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 19:09:44 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 19:09:44 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 19:09:44 INFO server handle success
0xc
2025/02/21 19:09:44 INFO client call success
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x54 pc=0x1fd7e49]

goroutine 39 [running]:
github.com/chenjie199234/Corelib/crpc.(*rw).closerecvsend(0xc000046db0?, 0x1, {0x0, 0x0})
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/rw.go:110 +0x89
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2.1()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:416 +0x458
github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc.func2()
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:426 +0x127
created by github.com/chenjie199234/Corelib/crpc.(*CrpcServer).userfunc in goroutine 38
C:/Users/陈杰/Desktop/Go/pkg/mod/github.com/chenjie199234/![email protected]/crpc/server.go:390 +0x23f9
exit status 2

Image

  1. in version 1.24.0,if i add some code after the panic line,then the panic gone
slog.Info("xxx", slog.Any("this_addr", atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&this)))))
or
fmt.Println(this)
here is the output
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:38:51 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:38:51 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:38:51 INFO server handle success
2025/02/21 18:38:51 INFO client call success
2025/02/21 18:38:51 INFO xxx this_addr=0xc0004802a0
PS C:\Users\陈杰\Desktop\Go\demo5> go run .\main.go
2025/02/21 18:38:56 INFO [crpc.server] online cip=127.0.0.1
2025/02/21 18:38:56 INFO [crpc.client] online sname=p-g.test sip=127.0.0.1:12345
2025/02/21 18:38:56 INFO server handle success
2025/02/21 18:38:56 INFO xxx this_addr=0xc000108120
2025/02/21 18:38:56 INFO client call success

the origin panic line 109 is: this.e = err,the import add 2 line
Image

What did you see happen?

same code
works fine in 1.23.6
panic in 1.24.0

What did you expect to see?

works fine

@Jorropo
Copy link
Member

Jorropo commented Feb 20, 2025

Do you know if this is not a race condition ?

@mknyszek
Copy link
Contributor

If you could post at least the error message as text, that would be helpful. Images are harder for us to work with in general.

Are you able to reproduce this? Are you able to share a small code example that reproduces the issue? Both of these would be very helpful to making progress. As @Jorropo suggests, try running your code under the race detector. If you see more unexpected crashes in your program past the upgrade, posting any additional crashes would also be helpful.

Unfortunately without more information it's hard for us to determine what the problem could be. Many changes go into each release. Since this is in your code, if it is an issue with Go, my guess would be either a bug in the compiler or some kind of GC liveness bug (though we haven't seen anything like that since the release).

@mknyszek mknyszek added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 20, 2025
@mknyszek mknyszek changed the title strange panic in 1.24.0,doesn't exist in 1.23.6 cmd/compile: nil dereference when storing field of non-nil struct value Feb 20, 2025
@mknyszek mknyszek added this to the Backlog milestone Feb 20, 2025
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Feb 20, 2025
@chenjie199234
Copy link
Author

@Jorropo this shouldn't be a race
i tested in both 1.24.0 and 1.23.6 for more then 30 times
100% panic in 1.24.0
0 panic in 1.23.6

@mknyszek
Copy link
Contributor

mknyszek commented Feb 20, 2025

@Jorropo this shouldn't be a race i tested in both 1.24.0 and 1.23.6 for more then 30 times 100% panic in 1.24.0 0 panic in 1.23.6

Unfortunately, data race bugs really can manifest in this way. Unrelated synchronization in the standard library and runtime can mask data race issues, and benign changes can similarly unmask them. Confirming that your code does not fail the race detector just provides everyone a much higher confidence that it isn't the root cause. We're not saying the problem is in your code necessarily, we just want to rule out possible explanations with high confidence.

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Feb 20, 2025
@chenjie199234
Copy link
Author

@mknyszek
i didn't set nil to the rw in any place in my code.
if i can call the function,it should not be gc.
the panic is very strange,i even don't known how to start to write the example code.

@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Feb 20, 2025
@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Feb 20, 2025
@mknyszek
Copy link
Contributor

I understand this is a surprising issue, but if we don't approach this systematically we won't be able to identify a root cause. I am not aware of any other recent issues that have similar symptoms, though perhaps someone else is.

We can dig deeper ourselves if you're able to provide some way to reproduce. If you cannot, our courses of action are limited. We can suggest more diagnostics and debugging modes (like the race detector, GODEBUG=cgocheck=1 if you're using cgo, GODEBUG=asyncpreemptoff=1, etc.) to try and narrow it down. We can also ask you to try and narrow down the problem yourself by bisecting between Go 1.23 (5e8a731) and Go 1.24 (3901409) and provide instructions on how to rebuild the Go toolchain.

@chenjie199234
Copy link
Author

@seankhliao @mknyszek
these logs in the image is the business log.
only the logs with red line and cycle is the debug log.
i don't known what i can do to help you to figure out what is happenning.
i'm very confuse the whole day,and it's midnight in my timezone now,i'm really tired.

please give me some guide to output some useful logs to help us find out the problem.
i will follow the guide tomorrow.thx very much,o7

@randall77
Copy link
Contributor

rw, is indeed not nil, it is the address 0x54. That address is clearly bad.

You should try and trace back to find out where that bad value came from. Try adding some clauses like if uintptr(unsafe.Pointer(rw)) < 1000 { panic(...) } to the callers.

@prattmic
Copy link
Member

rw, is indeed not nil, it is the address 0x54. That address is clearly bad.

0x54 should be the address of this + offsetof(e) not this itself. If the offset of e is 0x54, then this could be nil. Though 0x54 is not my count of the offset of e. In fact, shouldn't e be 8-byte aligned? So it definitely looks odd.

@Jorropo

This comment has been minimized.

@prattmic
Copy link
Member

@chenjie199234 It's unrelated to this bug, but it looks like go env may have a bug in printing your C:\User\... directory path. Could you provide more details on #71863.

@mknyszek
Copy link
Contributor

Unlikely, but maybe the line number in the output is wrong, and this offset makes sense for some other structure? (Maybe not this, but this.reader?) 🤷

@chenjie199234
Copy link
Author

chenjie199234 commented Feb 21, 2025

@mknyszek @prattmic @Jorropo @randall77
i update the issue's info
still can't find the reason
:(
the panic line is right
if i comment this.e = err
then panic on this.reader
if i comment this.e = err and this.reader then panic on this.callid

the addr is broken. when the panic happens,the addr is always 0xc and i can't find the reason

@randall77
Copy link
Contributor

the addr is broken. when the panic happens,the addr is always 0xc and i can't find the reason

This I believe is the crux of the problem. You have to figure out where that address came from.
Without a reproducer that we can run, we cannot help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

8 participants