Skip to content

runtime: pathological heap trigger/goal behavior #12199

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

Closed
aclements opened this issue Aug 19, 2015 · 4 comments
Closed

runtime: pathological heap trigger/goal behavior #12199

aclements opened this issue Aug 19, 2015 · 4 comments
Milestone

Comments

@aclements
Copy link
Member

While trying to write a good demonstration of the GC pacer, I managed to write something that drives the heap trigger and goal much too low (and sometimes drives the goal below the trigger): https://gist.github.com/aclements/fe5d9d0fdada390c2bb0

Despite this, the final heap size in each cycle is perfectly reasonable throughout the benchmark, though it's clearly slightly less controlled once the trigger and goal get out of whack.

gctrace

/cc @RLH

@aclements aclements added this to the Go1.6 milestone Aug 19, 2015
@aclements
Copy link
Member Author

What drives the heap goal down must be poor estimation of heap_reachable, since this is really all the goal is based on. The goal first goes haywire after the long GC cycle at ~2.2s caused by a low trigger; that gives the mutator a lot of time to allocate during the cycle (in fact, you can see how much it allocates during the cycle), and all of that allocation gets subtracted from the marked heap size before computing the goal of the next cycle.

This doesn't explain why the trigger first drops so low in the cycle at 2.2s.

@rsc
Copy link
Contributor

rsc commented Nov 24, 2015

Probably too late for Go 1.6.

@rsc rsc modified the milestones: Go1.7Early, Go1.6 Nov 24, 2015
@aclements
Copy link
Member Author

This turns out to be because heap_live was underestimating the true live heap size. In this case, it was seriously underestimating it. Since the triggering and pacing is based on heap_live, this underestimation lead to the erratic behavior. (I discovered this while debugging #13535, which turns out to be closely related.)

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/17748 mentions this issue.

@aclements aclements modified the milestones: Go1.6, Go1.7Early Dec 13, 2015
@golang golang locked and limited conversation to collaborators Dec 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants