-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Comments
Do you know if this is not a race condition ? |
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). |
@Jorropo this shouldn't be a race |
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. |
@mknyszek |
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, |
@seankhliao @mknyszek please give me some guide to output some useful logs to help us find out the problem. |
You should try and trace back to find out where that bad value came from. Try adding some clauses like |
0x54 should be the address of |
This comment has been minimized.
This comment has been minimized.
@chenjie199234 It's unrelated to this bug, but it looks like |
Unlikely, but maybe the line number in the output is wrong, and this offset makes sense for some other structure? (Maybe not |
@mknyszek @prattmic @Jorropo @randall77 the addr is broken. when the panic happens,the addr is always |
This I believe is the crux of the problem. You have to figure out where that address came from. |
Go version
1.24.0
go env
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
here is the demo's go.mod
here is the compare between 1.23.6 and 1.24.0
I also find some strange thing
-race
,the panic gone,but there has no race outputhere is the output
println(this)
to print the struct's addr,it shows the addr is0xc
,and every time is this addrhere is the log
after
the panic line,then the panic gonehere is the output
the origin panic line 109 is:

this.e = err
,the import add 2 lineWhat 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
The text was updated successfully, but these errors were encountered: