-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: runtime.GC can return without finishing sweep #45315
Comments
I've added some debuglogs and am running with gopool create -setup 'gomote push $VM && gomote run $VM go/src/make.bash && gomote run $VM go/bin/go test -c -o ../src/runtime/runtime.test -tags debuglog runtime' linux-amd64-sid
stress2 -p 5 -timeout 20m gopool run 'gomote run $VM go/src/runtime/runtime.test -quick -test.cpu=1,2,4' Here's a debug log from a test failure:
So the test is triggering a GC that ultimately frees the objects, but |
Some progress. |
I think I understand what's going on. Sweeping tracks two different types of completion: "we've swept or started sweeping all spans" (confusingly called For "all spans have been swept", we track that we've exited all calls to |
Do you expect to have a fix soon, or can the test be disabled until it is fixed? |
Change https://golang.org/cl/307809 mentions this issue: |
I just committed a workaround in |
This is a simple workaround for a bug where runtime.GC() can return before finishing a full sweep, causing gcTestIsReachable to throw. The right thing is to fix runtime.GC(), but this should get this test passing reliably in the meantime. Updates #45315. Change-Id: Iae141e6dbb26a9c2649497c1feedd4aaeaf540c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/307809 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Change https://golang.org/cl/307916 mentions this issue: |
Change https://golang.org/cl/307915 mentions this issue: |
The runtime currently has two different notions of sweep completion: 1. All spans are either swept or have begun sweeping. 2. The sweeper has *finished* sweeping all spans. Having both is confusing (it doesn't help that the documentation is often unclear or wrong). Condition 2 is stronger and the theoretical slight optimization that condition 1 could impact is never actually useful. Hence, this CL consolidates both conditions down to condition 2. Updates #45315. Change-Id: I55c84d767d74eb31a004a5619eaba2e351162332 Reviewed-on: https://go-review.googlesource.com/c/go/+/307916 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Backport candidate? |
I'm not sure this is really important enough to backport. It's incredibly difficult to trigger and difficult to observe even if you do trigger it. The most likely user effect is that you may observe a heap profile after calling |
As per #46500 (comment) this is unfortunately still possible. I will fix #46500 with an extra #46500 (comment) sketches out a fix. I'll re-upload the fix sketch CL too with this issue attached. |
Change https://golang.org/cl/333389 mentions this issue: |
Change https://golang.org/cl/333549 mentions this issue: |
This change fixes #46500 by working around #45315 which may cause freed objects to get missed in the heap profile published for the test. By calling runtime.GC one more time this change ensures that all freed objects are accounted for. Fixes #46500. Change-Id: Iedcd0b37dbaffa688b0ff8631a8b79f7a1169634 Reviewed-on: https://go-review.googlesource.com/c/go/+/333549 Trust: Michael Knyszek <mknyszek@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
@mknyszek , I think your analysis in #46500 (comment) is exactly right. Combining |
runtime.TestGCTestIsReachable
has been flaky since I added it. The failures look like:Some examples:
https://build.golang.org/log/6664ed5c503173b3f29eb85cb093baa61fb04838
https://build.golang.org/log/5608852a242f93bb2f36b6a56bebdefda3797e82
https://build.golang.org/log/231e6d68ccc2b858f8b002b45596356d8beb856c
I'm sure this has something to do with GC scheduling.
I haven't had any luck reproducing this locally. I'm now trying on the gomotes.
The text was updated successfully, but these errors were encountered: