-
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
x/mobile: gomobile apps crash inside runtime.usleep() on Android O beta #20409
Comments
Ah, I have a theory on what's happening. My theory is:
So it seems like the potential fixes are:
(1) seems preferable to me. |
The Go project can much more easily do (2) than (1). |
Yeah, certainly true. (2) is quite a large change -- there's an argument change (struct timespec vs. struct timeval) as well as the syscall number, across every Well, maybe we could limit the change to What do you think? Thanks. |
pselect was added to Linux in kernel 2.6.16 and Go requires 2.6.23 or later, so that seems fine to me at least. |
It makes me sad, but, yes, we could pretty easily switch to pselect. In fact, linux/arm64 already uses pselect. Of course, Go binaries that haven't been recompiled won't work with Android O. |
CL https://golang.org/cl/43641 mentions this issue. |
Could this be included in Go 1.9? Android O will probably be out (much) sooner than Go 1.10. |
It will be included in Go 1.9. A more interesting question is whether we should include this in Go 1.8.3. I'll reopen this on Go 1.8.3 for consideration. |
@aclements Thanks for the quick fix! Verified that it works on device, but the simulator's still crashing -- even though I'm on an amd64 machine, gomobile compiles for 386 and that's what the Android simulator's using. So we'll need the same select()->pselect6() fix for |
Punting to maybe Go 1.8.4 since this reportedly doesn't work yet anyway and we're doing Go 1.8.3 today. |
CL https://golang.org/cl/44011 mentions this issue. |
Thanks very much! Tested CL 44011 working in the simulator. |
@ianlancetaylor, is this something you're also comfortable backporting to the Go 1.8 branch? |
This is fine for 1.8 as far as I'm concerned. |
Re-re-opened for cherry-pick. |
CL https://golang.org/cl/44002 mentions this issue. |
CL https://golang.org/cl/44001 mentions this issue. |
…4 and linux/arm Android O black-lists the select system call because its libc, Bionic, does not use this system call. Replace our use of select with pselect6 (which is allowed) on the platforms that support targeting Android. linux/arm64 already uses pselect6 because there is no select on arm64, so only linux/amd64 and linux/arm need changing. pselect6 has been available since Linux 2.6.16, which is before Go's minimum requirement. Fixes #20409. Change-Id: Ic526b5b259a9e01d2f145a1f4d2e76e8c49ce809 Reviewed-on: https://go-review.googlesource.com/43641 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> (cherry picked from commit 4dcba02) Reviewed-on: https://go-review.googlesource.com/44001 Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Chris Broadfoot <[email protected]>
Commit 4dcba02 replaced select with pselect6 on linux/amd64 and linux/arm, but it turns out the Android emulator uses linux/386. This makes the equivalent change there, too. Fixes #20409 more. Change-Id: If542d6ade06309aab8758d5f5f6edec201ca7670 Reviewed-on: https://go-review.googlesource.com/44011 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> (cherry picked from commit ecad34a40ea390ddf5ba2da8f3c3f2c5f15297c8) Reviewed-on: https://go-review.googlesource.com/44002 Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Chris Broadfoot <[email protected]>
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8.1 linux/amd64
What operating system and processor architecture are you using (
go env
)?This is gomobile on Android O -- crashes on both x86 inside the simulator, and on device with arm64 on a Nexus 6P.
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
I called runtime.usleep() from Go code. I haven't made a minimal testcase yet, sorry.
What did you expect to see?
A delay.
What did you see instead?
Crashes due to seccomp policy violation. On amd64, in the Android simulator:
On ARM on a Nexus 6P:
I think system call 142 is sys_newselect, which makes sense -- that's how runtime.usleep() is implemented. But I don't understand why
select(2)
would be denied by the seccomp policy on Android O. Has anyone else noticed this, any ideas? Thanks!The text was updated successfully, but these errors were encountered: