-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: panic marked free object in span[1.17] #54247
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
Comments
does this reproduce with 1.18 or 1.19? |
1.18 didn't reproduce in 4h. I'm trying with 1.19. |
CC @golang/runtime. |
1.19 didn't reproduce either. Close it if you guys see O.K. as 1.17 is no longer supported. As I'm a little bit interesting what's causing this, I think it may relate to the |
May be solved by this commit: 0a0e3a3 |
confirmed. |
Yeah, 0a0e3a3 wasn't meant to fix anything, but maybe improved escape analysis in some cases and masked the issue. I'm curious if changing the Recover call to:
changes things at all? I could believe the 16-byte object is the backing array for the variadic function call. |
Yes, you're right. After changing Recover's arguments to a predefined slice, the issue no longer reproduced. If change the arguments to add 1 more
The elemsize becomes 24 bytes. |
Thanks. There's a lot of subtlety to how escape analysis, defers, and variadic functions interacted before. Internally, the compiler rewrites
into something like:
However, this rewriting was happening later in the compiler, after escape analysis. It's possible there was a misalignment between how escape analysis was analyzing the original form and the data flow of the resulting form. The effect of that change was to move the rewriting to before escape analysis, so that escape analysis can see how we actually rewrote the statement, rather than inferring how it should be rewritten. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, reproduced with 1.17.13.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Using
go build
to compile the following PoC.Run the following script to launch 90 processes. The count can be small, 90 only to fast the reproducing.
What did you expect to see?
The 90 processes can run forever without any panics.
What did you see instead?
Found panics, the stderr back trace as follow:
More information:
var a [125]int
line and the 2nd Recover argument are removed, no panics will occur;GOEXPERIMENT=noregabi
no panics will occur;Linux version 4.15.0-163-generic (buildd@lcy01-amd64-021) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #171-Ubuntu SMP Fri Nov 5 11:55:11 UTC 2021
)The text was updated successfully, but these errors were encountered: