-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Milestone
Description
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:
- Concurrent GC starts. Sweep termination runs and we enter concurrent mark.
- Test calls
SetGCPercent(-1). - Test enters a non-preemptible loop.
- 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