-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: go 1.3.3 (32-bits only) panics in gc involving cgo, C heap pointers and finalizers (afaict) #9866
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
Comments
No more work is being done on Go 1.3. Please re-open if the problem happens with Go 1.4 or tip. |
Less than six months support window. Noted. |
@chipaca, your sarcasm is unnecessary. The whole reason we have the Go 1 compatibility promise (https://golang.org/doc/go1compat) is so there's no reason for people to not upgrade from Go 1.n to Go 1.n+1. If something worked in Go 1.3 but doesn't work in Go 1.4, that's a bug and we'll fix it in Go 1.4 (in a point release) and at tip as well. That promise takes much more time than "six months". But what we're not going to do is go cherry-pick all fixes into all old releases of Go. |
Sorry about the sarcasm; I am rather upset about this. Code that works with 1.2 has stopped working in 1.3, leading to a FTBFS in Ubuntu's Vivid (15.04) (which is the first one with 1.3 and not out the door yet) for code that worked up to 14.10. So we're left with deciding whether to ship unsupported golang packages, and work around the issue and hope it is a valid workaround and not merely decreasing the probability of it in testing, or moving Vivid to 1.4 (which is not a call I can make, and given that 1.4 isn't yet out of Debian experimental -- let alone unstable -- it is rather unlikely). |
/cc @dvyukov for any thoughts. I agree that the release cycle mismatch between Go and Ubuntu/Debian is unfortunate, but it's hard to line up anything with Debian. |
The Go team is not going to make fixes in old Go releases. There is no way that our small team can maintain past releases indefinitely. People using our releases are expected to upgrade. However, you are not using our releases. You are using Debian's. There is nothing prevent Debian from patching an old release. That said, I have not looked at your code. Liveness analysis is getting increasingly more precise. Errors involving finalizers being run unexpectedly are more common in later releases. In particular, the fact that some variable is live at the beginning of a function does not mean that it is live at the end. This means that a finalizer may be running when you do not expect it. Take a close look at your finalizers and make sure that when they call into C there is no way that they can be touching any C memory that is referenced by any other Go value. |
Maybe I should've added that the issue is not present in 1.4? |
The way finalizers work for C resource finalization is very subtle. If you have code like: holder.cref = C.create() By the time C.use starts executing, holder becomes dead and so can be finalized while C.use executes. Looking at your patch, it seems that you can be affected by this subtlity. |
my bad, the effect of the workaround is simply to stopping the collection anyway the is no further use of ccu.cref in the code through ccu itself, On Fri, Feb 13, 2015 at 6:04 PM, Dmitry Vyukov notifications@github.com
|
What version of Go are you using (go version)?
1.3.3
What operating system and processor architecture are you using?
on Ubuntu, issue happens on both ARM and 386 (32 bits), but not amd64 (64 bits)
What did you do?
run repeatedly go test on the code in the package at
https://github.com/pedronis/go133explode.git
like with
apart the obvious deps, it needs:
This code is derived from a larger test suite, didn't manage to reduce further without making failure probability much lower.
On some tries on the listed 32 bit archs the code explodes with panics from inside the gc,
seen sometimes: fatal error: freelist empty
or signals are typical like:
they all seem to point to a corrupted freelist.
This change seems to workaround the issue, pointing in the direction of C-heap pointers and finalizers instead of an issue with the code itself. AFAIU go gc should be able to ignore C-heap pointers so this wouldn't be needed, indeed the code works fine with no panics without this change with 1.2, 1.4.1 and 1.3.3 on 64 bits:
The text was updated successfully, but these errors were encountered: