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

runtime: total allocation stats are managed in a uintptr which can quickly wrap around on 32-bit architectures #52680

Closed
mknyszek opened this issue May 3, 2022 · 7 comments
Labels
NeedsFix release-blocker Soon
Milestone

Comments

@mknyszek
Copy link
Contributor

@mknyszek mknyszek commented May 3, 2022

A runtime failure occurs on an assertion in ReadMemStats when running the internal/intern tests. I can reproduce it locally via:

GOARCH=386 go test internal/intern

On the 386 longtest builder: https://build.golang.org/log/38f434ccb5ed0db84e99122ef69eb1f3894d7d33

Curiously, it doesn't reproduce on amd64, AFAICT.

@mknyszek mknyszek added NeedsInvestigation release-blocker Soon labels May 3, 2022
@mknyszek mknyszek added this to the Go1.19 milestone May 3, 2022
@mknyszek mknyszek self-assigned this May 3, 2022
@mknyszek
Copy link
Contributor Author

@mknyszek mknyszek commented May 3, 2022

I understand the problem. This test allocates a whole lot of memory in a loop, > 4 GiB, and memstats.heapStats.largeAlloc is unfortunately a uintptr. It really should be a uint64. It's not the only one with this problem.

It's an easy fix and we should probably backport it.

@mknyszek mknyszek changed the title runtime: totalAlloc and consistent stats are not equal runtime: total allocation stats are managed in a uintptr which can quickly wrap around on 32-bit architectures May 3, 2022
@mknyszek mknyszek added the NeedsFix label May 3, 2022
@gopherbot gopherbot removed the NeedsInvestigation label May 3, 2022
@gopherbot
Copy link

@gopherbot gopherbot commented May 3, 2022

Change https://go.dev/cl/403758 mentions this issue: runtime: store consistent total allocation stats as uint64

@mknyszek
Copy link
Contributor Author

@mknyszek mknyszek commented May 3, 2022

@gopherbot Please open backport issues for Go 1.17 and Go 1.18.

@gopherbot
Copy link

@gopherbot gopherbot commented May 3, 2022

Backport issue(s) opened: #52688 (for 1.17), #52689 (for 1.18).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 9, 2022

Change https://go.dev/cl/411495 mentions this issue: [release-branch.go1.18] runtime: store consistent total allocation stats as uint64

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 9, 2022

Change https://go.dev/cl/411494 mentions this issue: [release-branch.go1.18] runtime: store consistent total allocation stats as uint64

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 9, 2022

Change https://go.dev/cl/411496 mentions this issue: [release-branch.go1.17] runtime: store consistent total allocation stats as uint64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix release-blocker Soon
Projects
None yet
Development

No branches or pull requests

2 participants