Skip to content
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/app: all example apps not working on android 4.2.2 #13741

Closed
star-tek-mb opened this issue Dec 27, 2015 · 6 comments
Closed

x/mobile/app: all example apps not working on android 4.2.2 #13741

star-tek-mb opened this issue Dec 27, 2015 · 6 comments
Milestone

Comments

@star-tek-mb
Copy link

@star-tek-mb star-tek-mb commented Dec 27, 2015

All examples from golang.org/x/mobile doesnt work. I have a log:

D/dalvikvm( 5567): Trying to load lib /data/app-lib/org.golang.todo.objloader-2/libobjloader.so 0x41926ca8
D/dalvikvm( 5567): Added shared lib /data/app-lib/org.golang.todo.objloader-2/libobjloader.so 0x41926ca8
V/PhoneWindow( 5567): DecorView setVisiblity: visibility = 4
I/SurfaceFlinger(  131): EventThread Client Pid (5567) created
F/libc    ( 5567): Fatal signal 11 (SIGSEGV) at 0x00000014 (code=1), thread 5567 (.todo.objloader)
D/AEE/AED (  125): $===AEE===AEE===AEE===$
D/AEE/AED (  125): p 0 poll events 1 revents 0
D/AEE/AED (  125): not know revents:0
D/AEE/AED (  125): p 1 poll events 1 revents 0
D/AEE/AED (  125): not know revents:0
D/AEE/AED (  125): p 2 poll events 1 revents 1
D/AEE/AED (  125): aed_main_fork_worker: generator 0xded168, worker 0xbedefa18, recv_fd 15
D/AEE/AED (  125): p 3 poll events 1 revents 0
D/AEE/AED (  125): not know revents:0
D/AEE/AED (  125): p 4 poll events 1 revents 0
D/AEE/AED (  125): not know revents:0
I/DEBUG   ( 5587): handle_request(15)
I/DEBUG   ( 5587): check process 5567 name:.todo.objloader
I/DEBUG   ( 5587): BOOM: pid=5567 uid=10079 gid=10079 tid=5567
I/DEBUG   ( 5587): [OnPurpose Redunant in preset_info] pid: 5567, tid: 5567, name: .todo.objloader  >>> org.golang.todo.objloader <<<
I/DEBUG   ( 5587): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 5587): Build fingerprint: 'alps/Adi_5S72_wet_jb3/Adi_5S72_wet_jb3:4.2.2/JDQ39/1390382314:user/test-keys'
I/DEBUG   ( 5587): pid: 5567, tid: 5567, name: .todo.objloader  >>> org.golang.todo.objloader <<<
I/DEBUG   ( 5587): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000014
I/DEBUG   ( 5587):     r0 00000014  r1 00000037  r2 00000000  r3 51730268
I/DEBUG   ( 5587):     r4 00000014  r5 00000037  r6 62456040  r7 00000034
I/DEBUG   ( 5587):     r8 00000000  r9 00000000  sl 623de2a0  fp 00000040
I/DEBUG   ( 5587):     ip 40160e74  sp bee804a0  lr 4015b6cd  pc 400a55e4  cpsr 20000010
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): backtrace:
I/DEBUG   ( 5587):     #00  pc 0000d5e4  /system/lib/libc.so
I/DEBUG   ( 5587):     #01  pc 000146c9  /system/lib/libutils.so (android::Looper::removeFd(int)+24)
I/DEBUG   ( 5587):     #02  pc 000531db  /system/lib/libandroid_runtime.so (AInputQueue::detachLooper()+24)
I/DEBUG   ( 5587):     #03  pc 000d2cd0  /data/app-lib/org.golang.todo.objloader-2/libobjloader.so (runtime.asmcgocall+84)
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): stack:
I/DEBUG   ( 5587):          bee80460  521130e0  /data/app-lib/org.golang.todo.objloader-2/libobjloader.so
I/DEBUG   ( 5587):          bee80464  bee80554  [stack]
I/DEBUG   ( 5587):          bee80468  00000000  
I/DEBUG   ( 5587):          bee8046c  408a768b  /system/lib/libdvm.so
I/DEBUG   ( 5587):          bee80470  62456040  [stack:5580]
I/DEBUG   ( 5587):          bee80474  0000001c  
I/DEBUG   ( 5587):          bee80478  62456040  [stack:5580]
I/DEBUG   ( 5587):          bee8047c  00000000  
I/DEBUG   ( 5587):          bee80480  623f6000  [stack:5580]
I/DEBUG   ( 5587):          bee80484  40903d80  /system/lib/libdvm.so
I/DEBUG   ( 5587):          bee80488  823df25c  
I/DEBUG   ( 5587):          bee8048c  40103204  
I/DEBUG   ( 5587):          bee80490  40924318  /system/lib/libdvm.so
I/DEBUG   ( 5587):          bee80494  40903dce  /system/lib/libdvm.so
I/DEBUG   ( 5587):          bee80498  bee80550  [stack]
I/DEBUG   ( 5587):          bee8049c  40103204  
I/DEBUG   ( 5587):     #00  bee804a0  51730268  
I/DEBUG   ( 5587):          bee804a4  00000014  
I/DEBUG   ( 5587):          bee804a8  00000037  
I/DEBUG   ( 5587):          bee804ac  62456040  [stack:5580]
I/DEBUG   ( 5587):          bee804b0  00000034  
I/DEBUG   ( 5587):          bee804b4  4015b6cd  /system/lib/libutils.so (android::Looper::removeFd(int)+28)
I/DEBUG   ( 5587):     #01  bee804b8  52006358  /data/app-lib/org.golang.todo.objloader-2/libobjloader.so (runtime.notewakeup+188)
I/DEBUG   ( 5587):          bee804bc  5204a23c  /data/app-lib/org.golang.todo.objloader-2/libobjloader.so (runtime.deferproc.func1+68)
I/DEBUG   ( 5587):          bee804c0  00000020  
I/DEBUG   ( 5587):          bee804c4  521130e0  /data/app-lib/org.golang.todo.objloader-2/libobjloader.so
I/DEBUG   ( 5587):          bee804c8  00000000  
I/DEBUG   ( 5587):          bee804cc  62456040  [stack:5580]
I/DEBUG   ( 5587):          bee804d0  5202eea8  /data/app-lib/org.golang.todo.objloader-2/libobjloader.so (runtime.acquirep+28)
I/DEBUG   ( 5587):          bee804d4  00000000  
I/DEBUG   ( 5587):          bee804d8  00000001  
I/DEBUG   ( 5587):          bee804dc  51702fe0  
I/DEBUG   ( 5587):          bee804e0  00000000  
I/DEBUG   ( 5587):          bee804e4  62456040  [stack:5580]
I/DEBUG   ( 5587):          bee804e8  0000000c  
I/DEBUG   ( 5587):          bee804ec  623f6000  [stack:5580]
I/DEBUG   ( 5587):          bee804f0  411f5c24  
I/DEBUG   ( 5587):          bee804f4  401fe1df  /system/lib/libandroid_runtime.so (AInputQueue::detachLooper()+28)
I/DEBUG   ( 5587):     #02  bee804f8  51702fe0  
I/DEBUG   ( 5587):          bee804fc  51730268  
I/DEBUG   ( 5587):          bee80500  00000070  
I/DEBUG   ( 5587):          bee80504  000000c8  
I/DEBUG   ( 5587):          bee80508  62404f58  [stack:5580]
I/DEBUG   ( 5587):          bee8050c  52052cd4  /data/app-lib/org.golang.todo.objloader-2/libobjloader.so (runtime.asmcgocall+88)
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): memory near r3:
I/DEBUG   ( 5587):     51730248 413bc620 00000016 0000000d 4193df98   .;A...........A
I/DEBUG   ( 5587):     51730258 00000000 00000000 00000218 0000001a  ................
I/DEBUG   ( 5587):     51730268 402a9a68 516d5298 516d5248 00000037  h.*@.RmQHRmQ7...
I/DEBUG   ( 5587):     51730278 00000018 0000002b 00140184 0a080115  ....+...........
I/DEBUG   ( 5587):     51730288 09090a01 0a09090a 09090909 01090903  ................
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): memory near r6:
I/DEBUG   ( 5587):     62456020 00000000 00000000 623eef70 520d4954  ........p.>bTI.R
I/DEBUG   ( 5587):     62456030 5215769c 00000000 62456000 623f6840  .v.R.....`Eb@h?b
I/DEBUG   ( 5587):     62456040 00000004 00000000 62404f24 51ffbab8  ........$O@b...Q
I/DEBUG   ( 5587):     62456050 5215776c 00000000 62422000 623f6000  lw.R..... Bb.`?b
I/DEBUG   ( 5587):     62456060 62456080 00000000 00000000 00000000  .`Eb............
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): memory near sl:
I/DEBUG   ( 5587):     623de280 00000000 00000000 00000000 00000000  ................
I/DEBUG   ( 5587):     623de290 00000000 00000000 00000000 00000000  ................
I/DEBUG   ( 5587):     623de2a0 bee784a0 bee808a0 bee78720 00000000  ........ .......
I/DEBUG   ( 5587):     623de2b0 00000000 00000000 623f6000 00000000  .........`?b....
I/DEBUG   ( 5587):     623de2c0 bee8052c 00000000 00000000 00000000  ,...............
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): memory near ip:
I/DEBUG   ( 5587):     40160e54 4010d930 400a4eb8 400ca094 400a4e9c  0..@.N.@...@.N.@
I/DEBUG   ( 5587):     40160e64 400ba3b0 400b9e3c 40093dcd 4010d91c  ...@<..@.=.@...@
I/DEBUG   ( 5587):     40160e74 400a5780 400a5cb0 400a6034 400a4ef0  .W.@.\.@4`.@.N.@
I/DEBUG   ( 5587):     40160e84 4012e6f5 4012e703 4012d0f0 400a5570  ...@...@...@pU.@
I/DEBUG   ( 5587):     40160e94 400bb9e0 400bbb10 40163239 401633ad  ...@...@92.@.3.@
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): memory near sp:
I/DEBUG   ( 5587):     bee80480 623f6000 40903d80 823df25c 40103204  .`?b.=.@\.=..2.@
I/DEBUG   ( 5587):     bee80490 40924318 40903dce bee80550 40103204  .C.@.=.@P....2.@
I/DEBUG   ( 5587):     bee804a0 51730268 00000014 00000037 62456040  h.sQ....7...@`Eb
I/DEBUG   ( 5587):     bee804b0 00000034 4015b6cd 52006358 5204a23c  4......@Xc.R<..R
I/DEBUG   ( 5587):     bee804c0 00000020 521130e0 00000000 62456040   ....0.R....@`Eb
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): code around pc:
I/DEBUG   ( 5587):     400a55c4 e3a00000 e12fff1e e3822901 eafffffa  ....../..)......
I/DEBUG   ( 5587):     400a55d4 e92d40f8 e2504000 03a00016 08bd80f8  .@-..@P.........
I/DEBUG   ( 5587):     400a55e4 e5942000 e2125903 e2026a02 1a000017  . ...Y...j......
I/DEBUG   ( 5587):     400a55f4 e3863001 e1942f9f e3a01000 e1320006  .0.../........2.
I/DEBUG   ( 5587):     400a5604 01841f93 e3510000 1afffff9 e1560002  ......Q.......V.
I/DEBUG   ( 5587): 
I/DEBUG   ( 5587): code around lr:
I/DEBUG   ( 5587):     4015b6ac bd38d1f8 43f0e92d f1004681 b0890414  ..8.-..C.F......
I/DEBUG   ( 5587):     4015b6bc f1094620 460d0734 0800f04f ee8ef7f7   F..4..FO.......
I/DEBUG   ( 5587):     4015b6cc 4638a903 f8cd9503 f7fd8018 4606fe90  ..8F...........F
I/DEBUG   ( 5587):     4015b6dc f7ffa804 4546ffcd 2102db22 0030f8d9  ......FE"..!..0.
I/DEBUG   ( 5587):     4015b6ec 4643462a e8a8f7f8 da0e4540 eeeef7f7  *FCF....@E......

I digged around and find, application crashes when call to C.AInputQueue_detachLooper() happened from CGO.

golang.org/x/mobile/example/gobind - works, when i build from console.

UPD: examples works on computer with Linux.

UPD: examples had worked before last updates of gomobile (or go) tool. It woked in go1.5 and gomobile (October or November release).

@rsc
Copy link
Contributor

@rsc rsc commented Dec 28, 2015

@rsc rsc added this to the Unreleased milestone Dec 28, 2015
@petrm
Copy link

@petrm petrm commented Feb 3, 2016

I am getting the same crash with the basic gomobile example on 4.04, 4.2.1, 4.4 with go1.5.3 and gomobile +77ab3b7. The example runs fine on 5.0.

@dskinner
Copy link
Member

@dskinner dskinner commented Mar 1, 2016

@nigeltao I bisected this issue to golang/mobile@11f6745

As far as I can tell, the call to C.AInputQueue_detachLooper is not necessary.

According to the documentation here http://developer.android.com/ndk/samples/sample_na.html regarding native_app_glue_code and the source (older commit) https://android.googlesource.com/platform/development/+/79b946e/ndk/sources/android/native_app_glue/android_native_app_glue.c, gomobile would need to be making use of native_app_glue_code for there to be a looper attached. I can't find any reference to such in gomobile as what native_app_glue_code normally provides is handled in https://github.com/golang/mobile/blob/master/app/android.c without attaching a looper.

My best guess is this results in the crash seen on 4.x and the error of trying to detach a looper that was never attached is ignored on 5.x.

If this sounds right to you, then the call to C.AInputQueue_detachLooper should be removed and I'd assume should be called in onInputQueueDestroyed and I can submit a CL doing such.

/cc @hyangah

@nigeltao
Copy link
Contributor

@nigeltao nigeltao commented Mar 2, 2016

OK, but there are two calls to C.AInputQueue_detachLooper. Are you saying that both should be removed?

We also have an explicit C.AInputQueue_attachLooper call (that's attach, not detach). Does removing the detaches mean that we'll leak something?

@dskinner
Copy link
Member

@dskinner dskinner commented Mar 2, 2016

I noticed this when reviewing HEAD (I just submitted https://go-review.googlesource.com/#/c/20145/) where-as in the referenced commit there was only one call.

What the CL does is only remove the errorneous detach call when the native activity callback is called. The input queue managed in android.go later on already processes any final events and calls detachLooper before proceeding with the new native input queue. So in theory, it shouldn't leak. But for any case I can think of that would leak would also apply to the current code as-is.

@star-tek-mb
Copy link
Author

@star-tek-mb star-tek-mb commented Mar 3, 2016

Thanks! All examples are working now!

@golang golang locked and limited conversation to collaborators Mar 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.