-
Notifications
You must be signed in to change notification settings - Fork 18k
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
x/mobile: go rand crash #21112
Comments
The code looks fine. Does it crash on only one device of yours, or multiple Android devices? Which ones? |
@bradfitz crashes in Go native code not captured by the system. So, it does only my device. My project is: https://gitlab.com/axet/android-torrent-client Device Nexus 9, arm It is hard to debug, but I can add some debug prints and say which numbers are causing the crash. But seems like 'j' out of index, only possible when 'r.Intn(i) <= i' and it should not crash when it is 0 or -1. I do not know what to do, but just ignore Perm() calls at all in my app... |
Nexus 9 uses https://en.wikipedia.org/wiki/Project_Denver and has known problems with certain instruction sequences. Go's compiler generates instruction sequences different from what Nexus 9 was tested with, so we apparently confuse the Project Denver JIT. See similar bug #19809 and all the bugs referenced from it in other non-Go projects. Nexus 9 just has a buggy CPU. It only works for Android because that's what was tested on it. Please try Go 1.9. Go 1.8 didn't include the 9d5987d Nexus 9 workaround. So you might be better off with that. Or maybe not. In any case, there's little we can do here. |
Seems works! |
@dr2chase has wanted to has the workaround backported to Go 1.8. Here is another case. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8.3 darwin/amd64
What operating system and processor architecture are you using (
go env
)?android
What did you do?
Seems like rand.Perm() has a bug, I'm getting a lot of crashes in my torrent app:
Seems like in rare conditions, function crashes while calulating 'j := r.Intn(i + 1)' which should be 'j := r.Intn(i)'
The text was updated successfully, but these errors were encountered: