-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: "sweep increased allocation count" when using reflect.Call #21717
Comments
Thanks for the great, short reproducer! I can confirm that I can reproduce locally with 1.9 on linux/amd64. GODEBUG=gccheckmark=1 fails almost immediately from the write barrier in
/cc @RLH |
The faulty line in reflect.Value.call is
on the write barrier of storing the second field ( I guess the problem is that, in this case, the return value is zero sized, so |
As a quick hack, the patch below seems to fix it:
|
@cherrymui Please note that crash doesn't reproduce if I remove func argument or replace it with
and
|
@g7r If the arg size is also zero, I guess (without carefully read the code) that it works because the |
This version also crashes:
|
Change https://golang.org/cl/60811 mentions this issue: |
If we consider sharing same |
@g7r this is not a bug. It is the same as normal Go does:
prints 0x10410020 0x10410020. |
As I noted on the change review, ‘[t]he property we want is “the ptr fields are either nil or valid pointers”, which is strictly weaker than “the ptr fields are either nil or distinct pointers”.’ We do also want it to be the case that a pointer to a struct field resides within the struct that contains it, and that every pointer field in a struct contains a valid pointer, but in that example the pointer does reside within the struct, and because |
Re-open for cherry-pick to Go 1.9. |
CL 60811 OK for Go 1.9.2. |
Change https://golang.org/cl/70971 mentions this issue: |
… zero-sized return value If a function with nonzero frame but zero-sized return value is Call'd, we may write a past-the-end pointer in preparing the return Values. Fix by return the zero value for zero-sized return value. Fixes #21717. Change-Id: I5351cd86d898467170a888b4c3fc9392f0e7aa3b Reviewed-on: https://go-review.googlesource.com/60811 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-on: https://go-review.googlesource.com/70971 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
go1.9.2 has been packaged and includes: The release is posted at golang.org/dl. — golang.org/x/build/cmd/releasebot, Oct 26 21:09:12 UTC |
Running test with
Does this deserve an investigation? Either |
@quasilyte This issue is closed and we believe the problem is fixed in the upcoming 1.10 release. I see no particular reason to think that the problem you are seeing is related to the problem that was fixed here. If you are seeing a repeatable problem with the development version, please open a new issue. Thanks. |
Change https://golang.org/cl/128475 mentions this issue: |
If an object is allocated as part of a tinyalloc, then other live objects in the same tinyalloc chunk keep the finalizer from being run, even if the object that has the finalizer is dead. Make sure the object we're setting the finalizer on is big enough to not trigger tinyalloc allocation. Fixes #26857 Update #21717 Change-Id: I56ad8679426283237ebff20a0da6c9cf64eb1c27 Reviewed-on: https://go-review.googlesource.com/128475 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
a bug in reflect.Value leads to issues during garbage collection (suspiciously dangling heap-pointers and mark+sweep issues) This should be fixed in go 1.9.2, so for now we force a garbage collection before every rendering, hopefully tackling this issue. golang/go#21717 targetprocess #147131
a bug in reflect.Value leads to issues during garbage collection (suspiciously dangling heap-pointers and mark+sweep issues) This should be fixed in go 1.9.2, so for now we force a garbage collection before every rendering, hopefully tackling this issue. golang/go#21717 targetprocess #147131
a bug in reflect.Value leads to issues during garbage collection (suspiciously dangling heap-pointers and mark+sweep issues) This should be fixed in go 1.9.2, so for now we force a garbage collection before every rendering, hopefully tackling this issue. golang/go#21717 targetprocess #147131
What version of Go are you using (
go version
)?go version go1.8.3 darwin/amd64
,go version go1.9 darwin/amd64
andgo version go1.8.3 linux/amd64
(i. e. all I've tried)Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
Infinite loop
What did you see instead?
Crash with message
fatal error: sweep increased allocation count
within a second or lessThe text was updated successfully, but these errors were encountered: