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/debug: SetGCPercent(-1) doesn't wait for concurrent GC #22443

Closed
aclements opened this issue Oct 25, 2017 · 1 comment
Closed

runtime/debug: SetGCPercent(-1) doesn't wait for concurrent GC #22443

aclements opened this issue Oct 25, 2017 · 1 comment

Comments

@aclements
Copy link
Member

@aclements aclements commented Oct 25, 2017

Several runtime tests use SetGCPercent(-1) to disable GC because they're about to do something that interferes with preemption (sigh, #10958). However, now that SetGCPercent no longer forces a full GC, it also doesn't force a currently running concurrent GC to terminate. This results in the following possible situation:

  1. Concurrent GC starts. Sweep termination runs and we enter concurrent mark.
  2. Test calls SetGCPercent(-1).
  3. Test enters a non-preemptible loop.
  4. Concurrent GC tries to STW to enter mark termination, but can't preempt the loop, so the test deadlocks.

This can be reproduced pretty quickly by running cd runtime; go test -c; GOGC=5 stress -p 1 ./runtime.test -test.short.

Since the point of SetGCPercent(-1) is to disabled GC, it should probably want for any concurrent GC cycle to finish.

/cc @RLH

@aclements aclements added this to the Go1.10 milestone Oct 25, 2017
@gopherbot
Copy link

@gopherbot gopherbot commented Nov 21, 2017

Change https://golang.org/cl/79195 mentions this issue: runtime/debug: make SetGCPercent(-1) wait for concurrent GC

@gopherbot gopherbot closed this in 64b68be Nov 22, 2017
@golang golang locked and limited conversation to collaborators Nov 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants