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: apps crash with malloc deadlock on Android #10469

Closed
rakyll opened this issue Apr 15, 2015 · 17 comments
Closed

x/mobile: apps crash with malloc deadlock on Android #10469

rakyll opened this issue Apr 15, 2015 · 17 comments
Milestone

Comments

@rakyll
Copy link
Contributor

rakyll commented Apr 15, 2015

My application crashes without a stack trace after device rotation if it doesn't register for orientation changes in the AndroidManifest.xml. It is only reproducible if the current activity's orientation is set to a value such as android:screenOrientation="landscape" in my case.

<?xml version="1.0" encoding="utf-8"?>
<manifest
  xmlns:android="http://schemas.android.com/apk/res/android"
  package="org.golang.todo.main"
  android:versionCode="1"
  android:versionName="1.0">

  <uses-sdk android:minSdkVersion="9" />
  <application android:label="Drum machine" android:hasCode="false" android:debuggable="true">
  <activity android:name="android.app.NativeActivity"
    android:label="Main"
    android:configChanges="keyboardHidden"
    android:screenOrientation="landscape">
    <meta-data android:name="android.app.lib_name" android:value="drummachine" />
    <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
  </application>
</manifest>

Update: Each Android apk that is built with gomobile crashes. It outputs a log with malloc deadlock. See #10469 (comment).

@hyangah
Copy link
Contributor

hyangah commented Apr 15, 2015

Not reporting stacktrace is worrisome - hopefully we figure out why there is no log and fix the problem before the freeze if possible. Can you provide a sample app and file a separate issue for it? You can assign the bug to me. Thanks!

@rakyll
Copy link
Contributor Author

rakyll commented Apr 15, 2015

go get -d github.com/rakyll/gomobilebugs/b10469 for a sample app to reproduce.

@hyangah
Copy link
Contributor

hyangah commented Apr 16, 2015

I got the crash logs

Tested Nexus5/lollipop and Nexus7/kitkit and they exhibit different types
of logs. malloc deadlock?.

Nexus5

I/ActivityManager( 744): START u0 {act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x10200000
cmp=org.golang.todo.main/android.app.NativeActivity (has extras)} from uid
10022 on display 0
D/audio_hw_primary( 182): out_set_parameters: enter: usecase(1:
low-latency-playback) kvpairs: routing=2
I/ActivityManager( 744): Start proc org.golang.todo.main for activity
org.golang.todo.main/android.app.NativeActivity: pid=3348 uid=10082
gids={50082, 9997} abi=armeabi
I/art ( 3348): Late-enabling -Xcheck:jni
W/linker ( 3348): libdrummachine.so has text relocations. This is wasting
memory and prevents security hardening. Please fix.
E/Go ( 3348): fatal error: malloc deadlock
E/Go ( 3348): fatal error: malloc deadlock
E/Go ( 3348): runtime stack:
E/Go ( 3348): runtime.throw(0xa415f960, 0xf)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/panic.go:543
+0x78
E/Go ( 3348): runtime.mallocgc(0x9c, 0xa414cea0, 0x0, 0x0)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/malloc.go:513
+0x144
E/Go ( 3348): runtime.newobject(0xa414cea0, 0x1)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/malloc.go:726
+0x58
E/Go ( 3348): runtime.malg(0x8000, 0xa41ddf30)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc1.go:2046
+0x28
E/Go ( 3348): runtime.mpreinit(0xa41de0d0)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/os1_linux.go:190
+0x24
E/Go ( 3348): runtime.mcommoninit(0xa41de0d0)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc1.go:115
+0x104
E/Go ( 3348): runtime.schedinit()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc1.go:57
+0x68
E/Go ( 3348): runtime.rt0_go(0xa3f03c68, 0x0, 0x0, 0xa3d24050, 0x0,
0xa3d160a0, 0xbea79bf8, 0xa41242a0, 0x0, 0xf, ...)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:60
+0x84
E/Go ( 3348): goroutine 1 [running, locked to thread]:
E/Go ( 3348): runtime.systemstack_switch()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:187
+0x4 fp=0x93d35f10 sp=0x93d35f0c
E/Go ( 3348): runtime.mallocgc(0x40, 0x0, 0x1, 0xa4089af4)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/malloc.go:609
+0x764 fp=0x93d35f7c sp=0x93d35f10
E/Go ( 3348): runtime.makechan(0xa4129fd8, 0x1, 0x0, 0x93d35fbc)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/chan.go:62
+0x260 fp=0x93d35fa4 sp=0x93d35f7c
E/Go ( 3348): runtime.gcenable()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mgc.go:165
+0x34 fp=0x93d35fbc sp=0x93d35fa4
E/Go ( 3348): runtime.main()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc.go:73
+0x148 fp=0x93d35fe4 sp=0x93d35fbc
E/Go ( 3348): runtime.goexit()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:982
+0x4 fp=0x93d35fe4 sp=0x93d35fe4
E/Go ( 3348): goroutine 17 [syscall, locked to thread]:
E/Go ( 3348): runtime.goexit()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:982
+0x4
E/Go ( 3348): runtime stack:
E/Go ( 3348): runtime.throw(0xa416fc60, 0x22)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/panic.go:543
+0x78
E/Go ( 3348): runtime.heapBitsForSpan(0x93d3c000, 0x0, 0x0)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mbitmap.go:142
+0x108
E/Go ( 3348): runtime.mCentral_Grow(0xa41e5a64, 0x93cfe0a0)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mcentral.go:207
+0x190
E/Go ( 3348): runtime.mCentral_CacheSpan(0xa41e5a64, 0x93d3a01c)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mcentral.go:83
+0x550
E/Go ( 3348): runtime.mCache_Refill(0xb3db6000, 0x5, 0x93d35fb8)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mcache.go:117
+0xdc
E/Go ( 3348): runtime.mallocgc.func2()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/malloc.go:608
+0x34
E/Go ( 3348): runtime.systemstack(0xa41ddf48)
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:239
+0x80
E/Go ( 3348): runtime.mstart()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc1.go:717
I/Zygote ( 193): Process 3348 exited cleanly (2)
I/ActivityManager( 744): Process org.golang.todo.main (pid 3348) has died

Nexus 7/kitkat

I/ActivityManager( 6833): Start proc org.golang.todo.main for activity
org.golang.todo.main/android.app.NativeActivity: pid=13730 uid=10340
gids={50340}
I/dalvikvm(13730): Enabling JNI app bug workarounds for target SDK version
9...
D/ActivityThread(13730): handleBindApplication:org.golang.todo.main
D/ActivityThread(13730): setTargetHeapUtilization:0.75
D/ActivityThread(13730): setTargetHeapMinFree:524288
F/libc (13730): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread
13744 (olang.todo.main)
I/Go (13730): app.Run
I/Go (13730): runtime started
D/libEGL (13730): loaded /system/lib/egl/libEGL_tegra.so
D/libEGL (13730): loaded /system/lib/egl/libGLESv1_CM_tegra.so
D/libEGL (13730): loaded /system/lib/egl/libGLESv2_tegra.so
I/DEBUG (13729): *** *** *** *** *** *** *** *** *** *** *** *** *** ***


I/DEBUG (13729): Build fingerprint:
'google/nakasi/grouper:4.4.3/KTU84L/1148727:user/release-keys'
I/DEBUG (13729): Revision: '0'
I/DEBUG (13729): pid: 13730, tid: 13744, name: olang.todo.main >>>
org.golang.todo.main <<<
I/DEBUG (13729): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr
00000000
I/DEBUG (13729): r0 00000000 r1 6b3a8ca0 r2 40000000 r3 6b05b498
I/DEBUG (13729): r4 6b18cf30 r5 00000003 r6 00000000 r7 00000000
I/DEBUG (13729): r8 6b18d0d0 r9 6b2acdd0 sl 6b18cf30 fp 80000000
I/DEBUG (13729): ip 2aaaaaaa sp 6b2acc18 lr 6b06364c pc 6b0659d0
cpsr 600d0010
I/DEBUG (13729): d0 ffffffffffffffff d1 fffffffffffffffe
I/DEBUG (13729): d2 676e616c6f672e67 d3 616d2e6f646f742e
I/DEBUG (13729): d4 3f8000003f800000 d5 3f80000000000000
I/DEBUG (13729): d6 3f13cd3600000000 d7 3f8000003f800000
I/DEBUG (13729): d8 0000000000000000 d9 0000000000000000
I/DEBUG (13729): d10 0000000000000000 d11 0000000000000000
I/DEBUG (13729): d12 0000000000000000 d13 0000000000000000
I/DEBUG (13729): d14 0000000000000000 d15 0000000000000000
I/DEBUG (13729): d16 0000000000000000 d17 0000000000000000
I/DEBUG (13729): d18 00ff008100800081 d19 00ff008100800081
I/DEBUG (13729): d20 0005000500050005 d21 0000000000000000
I/DEBUG (13729): d22 ff00800080108079 d23 0001000100010001
I/DEBUG (13729): d24 ff0080f1801e8010 d25 ff00801080078007
I/DEBUG (13729): d26 ff00801080e18100 d27 ff0080b5800080a5
I/DEBUG (13729): d28 ff0080fb80058005 d29 ff00803d80c3803a
I/DEBUG (13729): d30 0f0f0f0f0f0f0f0f d31 0101010101010101
I/DEBUG (13729): scr 30000011
I/DEBUG (13729):
I/DEBUG (13729): backtrace:
I/DEBUG (13729): #00 pc 000b49d0
/data/app-lib/org.golang.todo.main-1/libdrummachine.so (runtime.abort+4)
I/DEBUG (13729): #1 pc 000b2648
/data/app-lib/org.golang.todo.main-1/libdrummachine.so
(runtime.morestack+12)
I/DEBUG (13729):
I/DEBUG (13729): stack:
I/DEBUG (13729): 6b2acbd8 00000000
I/DEBUG (13729): 6b2acbdc 00000000
I/DEBUG (13729): 6b2acbe0 00000000
I/DEBUG (13729): 6b2acbe4 00000000
I/DEBUG (13729): 6b2acbe8 00000000
I/DEBUG (13729): 6b2acbec 00000000
I/DEBUG (13729): 6b2acbf0 00000000
I/DEBUG (13729): 6b2acbf4 00000000
I/DEBUG (13729): 6b2acbf8 00000000
I/DEBUG (13729): 6b2acbfc 00000000
I/DEBUG (13729): 6b2acc00 00000000
I/DEBUG (13729): 6b2acc04 00000000
I/DEBUG (13729): 6b2acc08 00000000
I/DEBUG (13729): 6b2acc0c 6b05b498
/data/app-lib/org.golang.todo.main-1/libdrummachine.so (runtime.dodiv+92)
I/DEBUG (13729): 6b2acc10 00000000
I/DEBUG (13729): 6b2acc14 80000000
I/DEBUG (13729): #00 6b2acc18 6b05b0c0
/data/app-lib/org.golang.todo.main-1/libdrummachine.so
(runtime.uint64div+204)
I/DEBUG (13729): ........ ........
I/DEBUG (13729): #1 6b2acc18 6b05b0c0
/data/app-lib/org.golang.todo.main-1/libdrummachine.so
(runtime.uint64div+204)
I/DEBUG (13729): 6b2acc1c 00000002
I/DEBUG (13729): 6b2acc20 40000000
I/DEBUG (13729): 6b2acc24 00000003
I/DEBUG (13729): 6b2acc28 00000000
I/DEBUG (13729): 6b2acc2c aaaaaaab
I/DEBUG (13729): 6b2acc30 2aaaaaaa
I/DEBUG (13729): 6b2acc34 00000001
I/DEBUG (13729): 6b2acc38 00000000
I/DEBUG (13729): 6b2acc3c 6b036b98
/data/app-lib/org.golang.todo.main-1/libdrummachine.so
(runtime.computeDivMagic+328)
I/DEBUG (13729): 6b2acc40 00000002
I/DEBUG (13729): 6b2acc44 40000000
I/DEBUG (13729): 6b2acc48 00000003
I/DEBUG (13729): 6b2acc4c 00000000
I/DEBUG (13729): 6b2acc50 aaaaaaab
I/DEBUG (13729): 6b2acc54 2aaaaaaa
I/DEBUG (13729):
....
W/InputDispatcher( 6833): channel '428e63d8
org.golang.todo.main/android.app.NativeActivity (server)' ~ Consumer closed
input channel or an error occurred. events=0x9
E/InputDispatcher( 6833): channel '428e63d8
org.golang.todo.main/android.app.NativeActivity (server)' ~ Channel is
unrecoverably broken and will be disposed!
I/BootReceiver( 6833): Copying /data/tombstones/tombstone_06 to DropBox
(SYSTEM_TOMBSTONE)
W/InputDispatcher( 6833): Attempted to unregister already unregistered
input channel '428e63d8 org.golang.todo.main/android.app.NativeActivity
(server)'
I/WindowState( 6833): WIN DEATH: Window{428e63d8 u0
org.golang.todo.main/android.app.NativeActivity}
I/ActivityManager( 6833): Process org.golang.todo.main (pid 13730) has died.
W/ActivityManager( 6833): Force removing ActivityRecord{41df9670 u0
org.golang.todo.main/android.app.NativeActivity t31}: app died, no saved
state
D/Zygote ( 6567): Process 13730 terminated by signal (11)
W/ActivityManager( 6833): Process org.golang.todo.main has crashed too many
times: killing!

2015-04-15 16:18 GMT-04:00 Burcu Dogan notifications@github.com:

go get -d github.com/rakyll/gomobilebugs/b10469 for a sample app to
reproduce.


Reply to this email directly or view it on GitHub
#10469 (comment).

__

@hyangah
Copy link
Contributor

hyangah commented Apr 16, 2015

go version
go version devel +7e0c11c Wed Apr 15 19:17:07 2015 +0000 linux/amd64

and apk built with gomobile.

2015-04-16 16:16 GMT-04:00 Hyang-Ah Hana Kim hyangah@gmail.com:

I got the crash logs

Tested Nexus5/lollipop and Nexus7/kitkit and they exhibit different types
of logs. malloc deadlock?.

Nexus5

I/ActivityManager( 744): START u0 {act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x10200000
cmp=org.golang.todo.main/android.app.NativeActivity (has extras)} from uid
10022 on display 0
D/audio_hw_primary( 182): out_set_parameters: enter: usecase(1:
low-latency-playback) kvpairs: routing=2
I/ActivityManager( 744): Start proc org.golang.todo.main for activity
org.golang.todo.main/android.app.NativeActivity: pid=3348 uid=10082
gids={50082, 9997} abi=armeabi
I/art ( 3348): Late-enabling -Xcheck:jni
W/linker ( 3348): libdrummachine.so has text relocations. This is wasting
memory and prevents security hardening. Please fix.
E/Go ( 3348): fatal error: malloc deadlock
E/Go ( 3348): fatal error: malloc deadlock
E/Go ( 3348): runtime stack:
E/Go ( 3348): runtime.throw(0xa415f960, 0xf)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/panic.go:543
+0x78
E/Go ( 3348): runtime.mallocgc(0x9c, 0xa414cea0, 0x0, 0x0)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/malloc.go:513
+0x144
E/Go ( 3348): runtime.newobject(0xa414cea0, 0x1)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/malloc.go:726
+0x58
E/Go ( 3348): runtime.malg(0x8000, 0xa41ddf30)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc1.go:2046
+0x28
E/Go ( 3348): runtime.mpreinit(0xa41de0d0)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/os1_linux.go:190
+0x24
E/Go ( 3348): runtime.mcommoninit(0xa41de0d0)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc1.go:115
+0x104
E/Go ( 3348): runtime.schedinit()
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc1.go:57
+0x68
E/Go ( 3348): runtime.rt0_go(0xa3f03c68, 0x0, 0x0, 0xa3d24050, 0x0,
0xa3d160a0, 0xbea79bf8, 0xa41242a0, 0x0, 0xf, ...)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:60
+0x84
E/Go ( 3348): goroutine 1 [running, locked to thread]:
E/Go ( 3348): runtime.systemstack_switch()
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:187
+0x4 fp=0x93d35f10 sp=0x93d35f0c
E/Go ( 3348): runtime.mallocgc(0x40, 0x0, 0x1, 0xa4089af4)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/malloc.go:609
+0x764 fp=0x93d35f7c sp=0x93d35f10
E/Go ( 3348): runtime.makechan(0xa4129fd8, 0x1, 0x0, 0x93d35fbc)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/chan.go:62
+0x260 fp=0x93d35fa4 sp=0x93d35f7c
E/Go ( 3348): runtime.gcenable()
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mgc.go:165
+0x34 fp=0x93d35fbc sp=0x93d35fa4
E/Go ( 3348): runtime.main()
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc.go:73
+0x148 fp=0x93d35fe4 sp=0x93d35fbc
E/Go ( 3348): runtime.goexit()
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:982
+0x4 fp=0x93d35fe4 sp=0x93d35fe4
E/Go ( 3348): goroutine 17 [syscall, locked to thread]:
E/Go ( 3348): runtime.goexit()
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:982
+0x4
E/Go ( 3348): runtime stack:
E/Go ( 3348): runtime.throw(0xa416fc60, 0x22)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/panic.go:543
+0x78
E/Go ( 3348): runtime.heapBitsForSpan(0x93d3c000, 0x0, 0x0)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mbitmap.go:142
+0x108
E/Go ( 3348): runtime.mCentral_Grow(0xa41e5a64, 0x93cfe0a0)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mcentral.go:207
+0x190
E/Go ( 3348): runtime.mCentral_CacheSpan(0xa41e5a64, 0x93d3a01c)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mcentral.go:83
+0x550
E/Go ( 3348): runtime.mCache_Refill(0xb3db6000, 0x5, 0x93d35fb8)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/mcache.go:117
+0xdc
E/Go ( 3348): runtime.mallocgc.func2()
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/malloc.go:608
+0x34
E/Go ( 3348): runtime.systemstack(0xa41ddf48)
E/Go ( 3348): /usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/asm_arm.s:239
+0x80
E/Go ( 3348): runtime.mstart()
E/Go ( 3348):
/usr/local/google/home/hakim/golang/gopaths/ws4/pkg/gomobile/android-ndk-r10d/gomobile-init-788832144/go/src/runtime/proc1.go:717
I/Zygote ( 193): Process 3348 exited cleanly (2)
I/ActivityManager( 744): Process org.golang.todo.main (pid 3348) has died

Nexus 7/kitkat

I/ActivityManager( 6833): Start proc org.golang.todo.main for activity
org.golang.todo.main/android.app.NativeActivity: pid=13730 uid=10340
gids={50340}
I/dalvikvm(13730): Enabling JNI app bug workarounds for target SDK version
9...
D/ActivityThread(13730): handleBindApplication:org.golang.todo.main
D/ActivityThread(13730): setTargetHeapUtilization:0.75
D/ActivityThread(13730): setTargetHeapMinFree:524288
F/libc (13730): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1),
thread 13744 (olang.todo.main)
I/Go (13730): app.Run
I/Go (13730): runtime started
D/libEGL (13730): loaded /system/lib/egl/libEGL_tegra.so
D/libEGL (13730): loaded /system/lib/egl/libGLESv1_CM_tegra.so
D/libEGL (13730): loaded /system/lib/egl/libGLESv2_tegra.so
I/DEBUG (13729): *** *** *** *** *** *** *** *** *** *** *** *** *** ***


I/DEBUG (13729): Build fingerprint:
'google/nakasi/grouper:4.4.3/KTU84L/1148727:user/release-keys'
I/DEBUG (13729): Revision: '0'
I/DEBUG (13729): pid: 13730, tid: 13744, name: olang.todo.main >>>
org.golang.todo.main <<<
I/DEBUG (13729): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr
00000000
I/DEBUG (13729): r0 00000000 r1 6b3a8ca0 r2 40000000 r3 6b05b498
I/DEBUG (13729): r4 6b18cf30 r5 00000003 r6 00000000 r7 00000000
I/DEBUG (13729): r8 6b18d0d0 r9 6b2acdd0 sl 6b18cf30 fp 80000000
I/DEBUG (13729): ip 2aaaaaaa sp 6b2acc18 lr 6b06364c pc 6b0659d0
cpsr 600d0010
I/DEBUG (13729): d0 ffffffffffffffff d1 fffffffffffffffe
I/DEBUG (13729): d2 676e616c6f672e67 d3 616d2e6f646f742e
I/DEBUG (13729): d4 3f8000003f800000 d5 3f80000000000000
I/DEBUG (13729): d6 3f13cd3600000000 d7 3f8000003f800000
I/DEBUG (13729): d8 0000000000000000 d9 0000000000000000
I/DEBUG (13729): d10 0000000000000000 d11 0000000000000000
I/DEBUG (13729): d12 0000000000000000 d13 0000000000000000
I/DEBUG (13729): d14 0000000000000000 d15 0000000000000000
I/DEBUG (13729): d16 0000000000000000 d17 0000000000000000
I/DEBUG (13729): d18 00ff008100800081 d19 00ff008100800081
I/DEBUG (13729): d20 0005000500050005 d21 0000000000000000
I/DEBUG (13729): d22 ff00800080108079 d23 0001000100010001
I/DEBUG (13729): d24 ff0080f1801e8010 d25 ff00801080078007
I/DEBUG (13729): d26 ff00801080e18100 d27 ff0080b5800080a5
I/DEBUG (13729): d28 ff0080fb80058005 d29 ff00803d80c3803a
I/DEBUG (13729): d30 0f0f0f0f0f0f0f0f d31 0101010101010101
I/DEBUG (13729): scr 30000011
I/DEBUG (13729):
I/DEBUG (13729): backtrace:
I/DEBUG (13729): #00 pc 000b49d0
/data/app-lib/org.golang.todo.main-1/libdrummachine.so (runtime.abort+4)
I/DEBUG (13729): #1 pc 000b2648
/data/app-lib/org.golang.todo.main-1/libdrummachine.so
(runtime.morestack+12)
I/DEBUG (13729):
I/DEBUG (13729): stack:
I/DEBUG (13729): 6b2acbd8 00000000
I/DEBUG (13729): 6b2acbdc 00000000
I/DEBUG (13729): 6b2acbe0 00000000
I/DEBUG (13729): 6b2acbe4 00000000
I/DEBUG (13729): 6b2acbe8 00000000
I/DEBUG (13729): 6b2acbec 00000000
I/DEBUG (13729): 6b2acbf0 00000000
I/DEBUG (13729): 6b2acbf4 00000000
I/DEBUG (13729): 6b2acbf8 00000000
I/DEBUG (13729): 6b2acbfc 00000000
I/DEBUG (13729): 6b2acc00 00000000
I/DEBUG (13729): 6b2acc04 00000000
I/DEBUG (13729): 6b2acc08 00000000
I/DEBUG (13729): 6b2acc0c 6b05b498
/data/app-lib/org.golang.todo.main-1/libdrummachine.so (runtime.dodiv+92)
I/DEBUG (13729): 6b2acc10 00000000
I/DEBUG (13729): 6b2acc14 80000000
I/DEBUG (13729): #00 6b2acc18 6b05b0c0
/data/app-lib/org.golang.todo.main-1/libdrummachine.so
(runtime.uint64div+204)
I/DEBUG (13729): ........ ........
I/DEBUG (13729): #1 6b2acc18 6b05b0c0
/data/app-lib/org.golang.todo.main-1/libdrummachine.so
(runtime.uint64div+204)
I/DEBUG (13729): 6b2acc1c 00000002
I/DEBUG (13729): 6b2acc20 40000000
I/DEBUG (13729): 6b2acc24 00000003
I/DEBUG (13729): 6b2acc28 00000000
I/DEBUG (13729): 6b2acc2c aaaaaaab
I/DEBUG (13729): 6b2acc30 2aaaaaaa
I/DEBUG (13729): 6b2acc34 00000001
I/DEBUG (13729): 6b2acc38 00000000
I/DEBUG (13729): 6b2acc3c 6b036b98
/data/app-lib/org.golang.todo.main-1/libdrummachine.so
(runtime.computeDivMagic+328)
I/DEBUG (13729): 6b2acc40 00000002
I/DEBUG (13729): 6b2acc44 40000000
I/DEBUG (13729): 6b2acc48 00000003
I/DEBUG (13729): 6b2acc4c 00000000
I/DEBUG (13729): 6b2acc50 aaaaaaab
I/DEBUG (13729): 6b2acc54 2aaaaaaa
I/DEBUG (13729):
....
W/InputDispatcher( 6833): channel '428e63d8
org.golang.todo.main/android.app.NativeActivity (server)' ~ Consumer closed
input channel or an error occurred. events=0x9
E/InputDispatcher( 6833): channel '428e63d8
org.golang.todo.main/android.app.NativeActivity (server)' ~ Channel is
unrecoverably broken and will be disposed!
I/BootReceiver( 6833): Copying /data/tombstones/tombstone_06 to DropBox
(SYSTEM_TOMBSTONE)
W/InputDispatcher( 6833): Attempted to unregister already unregistered
input channel '428e63d8 org.golang.todo.main/android.app.NativeActivity
(server)'
I/WindowState( 6833): WIN DEATH: Window{428e63d8 u0
org.golang.todo.main/android.app.NativeActivity}
I/ActivityManager( 6833): Process org.golang.todo.main (pid 13730) has
died.
W/ActivityManager( 6833): Force removing ActivityRecord{41df9670 u0
org.golang.todo.main/android.app.NativeActivity t31}: app died, no saved
state
D/Zygote ( 6567): Process 13730 terminated by signal (11)
W/ActivityManager( 6833): Process org.golang.todo.main has crashed too
many times: killing!

2015-04-15 16:18 GMT-04:00 Burcu Dogan notifications@github.com:

go get -d github.com/rakyll/gomobilebugs/b10469 for a sample app to
reproduce.


Reply to this email directly or view it on GitHub
#10469 (comment).

__

__

@rakyll
Copy link
Contributor Author

rakyll commented Apr 17, 2015

I have reinited gomobile and am able to see a similar crash log as soon as app launches.

go version devel +7f983f2 Fri Apr 17 04:31:48 2015 +0000 darwin/amd64

Nexus 9, kernel version: 3.10.40, android version: 5.0.2.

@rakyll
Copy link
Contributor Author

rakyll commented Apr 17, 2015

Failed to append the log last night, doing it now.

I/ActivityManager(  849): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.golang.todo.main/android.app.NativeActivity (has extras)} from uid 10022 on display 0
D/Velvet.SearchPlate(14484): hideKeyboard: false
I/ActivityManager(  849): Start proc org.golang.todo.main for activity org.golang.todo.main/android.app.NativeActivity: pid=12329 uid=10083 gids={50083, 9997} abi=armeabi
I/art     (12329): Late-enabling -Xcheck:jni
V/PhoneStatusBar( 1302): setLightsOn(true)
W/linker  (12329): libdrummachine.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
I/Zygote  (  609): Process 12329 exited due to signal (11)
I/ActivityManager(  849): Process org.golang.todo.main (pid 12329) has died
I/ActivityManager(  849): Start proc org.golang.todo.main for activity org.golang.todo.main/android.app.NativeActivity: pid=12348 uid=10083 gids={50083, 9997} abi=armeabi
I/art     (12348): Late-enabling -Xcheck:jni
I/art     (  849): Explicit concurrent mark sweep GC freed 30132(1340KB) AllocSpace objects, 5(240KB) LOS objects, 29% free, 37MB/53MB, paused 4.627ms total 150.219ms
W/linker  (12348): libdrummachine.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
F/libc    (12348): Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7af3c000 in tid 12365 (Thread-1452)
E/Go      (12348): fatal error: malloc deadlock
E/Go      (12348): runtime stack:
E/Go      (12348): runtime.throw(0xf4233a60, 0xf)
E/Go      (12348):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/panic.go:543 +0x78
E/Go      (12348): runtime.mallocgc(0x954, 0xf421e0e0, 0x0, 0xf406b370)
E/Go      (12348):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/malloc.go:513 +0x144
E/Go      (12348): runtime.newobject(0xf421e0e0, 0x4f97)
E/Go      (12348):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/malloc.go:726 +0x58
E/Go      (12348): runtime.procresize(0x1, 0x0)
E/Go      (12348):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/proc1.go:2540 +0x180
E/Go      (12348): runtime.schedinit()
E/Go      (12348):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/proc1.go:73 +0xfc
E/Go      (12348): runtime.rt0_go(0x1, 0xf42b8b58, 0xf71efecf, 0xf71efeb5, 0xab57fbf0, 0xf71efeb5, 0xf71edea9, 0xf05f5dd0, 0x0, 0xf05f5dd0, ...)
E/Go      (12348):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/asm_arm.s:60 +0x84
I/ActivityManager(  849): Process org.golang.todo.main (pid 12348) has died
E/DEBUG   ( 5055): unexpected waitpid response: n=12365, status=00000200
I/Zygote  (  609): Process 12348 exited cleanly (2)
E/        ( 5055): ptrace detach from 12365 failed: No such process
E/        ( 5055): debuggerd committing suicide to free the zombie!
I/ActivityManager(  849): Start proc org.golang.todo.main for activity org.golang.todo.main/android.app.NativeActivity: pid=12367 uid=10083 gids={50083, 9997} abi=armeabi
I/art     (12367): Late-enabling -Xcheck:jni
I/        (12366): debuggerd: Dec 11 2014 02:19:53
W/linker  (12367): libdrummachine.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
E/Go      (12367): fatal error: malloc deadlock
E/Go      (12367): runtime stack:
F/libc    (12367): Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7af3c000 in tid 12383 (olang.todo.main)
E/Go      (12367): runtime.throw(0xf4233a60, 0xf)
E/Go      (12367):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/panic.go:543 +0x78
E/Go      (12367): runtime.mallocgc(0x9c, 0xf421f5e0, 0x0, 0x0)
E/Go      (12367):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/malloc.go:513 +0x144
E/Go      (12367): runtime.newobject(0xf421f5e0, 0x1)
E/Go      (12367):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/malloc.go:726 +0x58
E/Go      (12367): runtime.malg(0x8000, 0xf42c71f0)
E/Go      (12367):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/proc1.go:2046 +0x28
E/Go      (12367): runtime.mpreinit(0xf42c7390)
E/Go      (12367):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/os1_linux.go:190 +0x24
E/Go      (12367): runtime.mcommoninit(0xf42c7390)
E/Go      (12367):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/proc1.go:115 +0x104
E/Go      (12367): runtime.schedinit()
E/Go      (12367):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/proc1.go:57 +0x68
E/Go      (12367): runtime.rt0_go(0xf04f7c88, 0x0, 0x0, 0xab56ce10, 0x0, 0xab580970, 0xff947be8, 0xf41ebe90, 0x0, 0xf, ...)
E/Go      (12367):  /Users/jbd/pkg/gomobile/android-ndk-r10d/gomobile-init-741047152/go/src/runtime/asm_arm.s:60 +0x84
I/ActivityManager(  849): Process org.golang.todo.main (pid 12367) has died
W/ActivityManager(  849): Force removing ActivityRecord{b1f87d6 u0 org.golang.todo.main/android.app.NativeActivity t225}: app died, no saved state
E/DEBUG   (12366): unexpected waitpid response: n=12383, status=00000200
I/Zygote  (  609): Process 12367 exited cleanly (2)
E/        (12366): ptrace detach from 12383 failed: No such process
E/        (12366): debuggerd committing suicide to free the zombie!
W/WindowManager(  849): Failed looking up window
W/WindowManager(  849): java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W@3f8e5a2d does not exist
W/WindowManager(  849):     at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8412)
W/WindowManager(  849):     at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8403)
W/WindowManager(  849):     at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2558)
W/WindowManager(  849):     at com.android.server.wm.Session.remove(Session.java:186)
W/WindowManager(  849):     at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:2920)
W/WindowManager(  849):     at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5390)
W/WindowManager(  849):     at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3223)
W/WindowManager(  849):     at android.os.Handler.dispatchMessage(Handler.java:102)
W/WindowManager(  849):     at android.os.Looper.loop(Looper.java:135)
W/WindowManager(  849):     at android.os.HandlerThread.run(HandlerThread.java:61)
W/WindowManager(  849):     at com.android.server.ServiceThread.run(ServiceThread.java:46)
W/ProcessCpuTracker(  849): Skipping unknown process pid 12366
W/ProcessCpuTracker(  849): Skipping unknown process pid 12367
W/InputMethodManagerService(  849): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@2167289d attribute=null, token = android.os.BinderProxy@1bd712a2

@rakyll
Copy link
Contributor Author

rakyll commented Apr 17, 2015

The basic example crashes with the log below.

/ActivityManager(  849): Process com.example.basic (pid 16799) has died
I/ActivityManager(  849): Start proc com.example.basic for activity com.example.basic/android.app.NativeActivity: pid=16819 uid=10082 gids={50082, 9997} abi=armeabi
W/linker  (16819): libbasic.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
F/libc    (16819): Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7af3c000 in tid 16835 (Thread-1536)
I/libc    (16819): Suppressing debuggerd output because prctl(PR_GET_DUMPABLE)==0
I/Zygote  (  609): Process 16819 exited due to signal (11)
I/ActivityManager(  849): Process com.example.basic (pid 16819) has died
I/ActivityManager(  849): Start proc com.example.basic for activity com.example.basic/android.app.NativeActivity: pid=16836 uid=10082 gids={50082, 9997} abi=armeabi
W/linker  (16836): libbasic.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
E/Go      (16836): fatal error: malloc deadlock
F/libc    (16836): Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7af3c000 in tid 16852 (Thread-1541)
I/libc    (16836): Suppressing debuggerd output because prctl(PR_GET_DUMPABLE)==0
I/Zygote  (  609): Process 16836 exited due to signal (11)
I/ActivityManager(  849): Process com.example.basic (pid 16836) has died
W/ActivityManager(  849): Force removing ActivityRecord{3f5c1604 u0 com.example.basic/android.app.NativeActivity t231}: app died, no saved state

@rakyll rakyll changed the title x/mobile: application crashes if AndroidManifest doesn't register for orientation changes x/mobile: apps crash with malloc deadlock on Android Apr 17, 2015
@hyangah
Copy link
Contributor

hyangah commented Apr 17, 2015

I guess the malloc deadlock is a red herring. The preceding log message may be the more interesting one.

F/libc (12348): Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7af3c000 in tid 12365 (Thread-1452)

Now we are going through many changes in the main and the mobile repositories, let's continue debugging after the dust settles.

@eliasnaur
Copy link
Contributor

FWIW, I'm unable to reproduce the crashes on

  • Nexus 5 Android 5.1
  • Nexus 5 Cyanogenmod 4.4.4
  • HTC One S Android 4.1.1

Running gomobile tip (4e56a5f1a) and Go tip (3115952)

@rakyll
Copy link
Contributor Author

rakyll commented May 19, 2015

Still reproducible on Nexus 9 - Android 5.0.2 and Nexus 9 - Android 5.1.1.

@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Jun 3, 2015
@eliasnaur
Copy link
Contributor

Is this still reproducible? If it is, the cause seems like a core Go problem and according to

https://groups.google.com/forum/#!topic/golang-dev/fcIhmOnwhK8

the 1.5 beta is close and I would prefer the (possible) fix for this issue not get rejected because of stricter CL standards. I'd happily do the debugging myself, but I don't have access to a Nexus 9.

@hyangah hyangah assigned rakyll and unassigned hyangah Jun 29, 2015
@hyangah
Copy link
Contributor

hyangah commented Jun 29, 2015

@rakyll can you check if it's still reproducible on your Nexus 9?

@rakyll
Copy link
Contributor Author

rakyll commented Jun 29, 2015

I don't have an Android device with me currently, will give it a try this evening.

@rakyll rakyll modified the milestones: Go1.5, Unreleased Jun 30, 2015
@rakyll
Copy link
Contributor Author

rakyll commented Jun 30, 2015

I can't reproduce this bug, closing.

@rakyll rakyll closed this as completed Jun 30, 2015
@fjl
Copy link

fjl commented Nov 4, 2015

We've also seen this happen on ARM with Go 1.5.1, the issue seems unrelated to gomobile.
https://gist.github.com/CJentzsch/31aab5b31fae6805f893

Should we open a new issue about this?

@crawshaw
Copy link
Member

crawshaw commented Nov 4, 2015

@fjl yes please, and any way to reproduce it would be appreciated.

@fjl
Copy link

fjl commented Nov 4, 2015

Opened #13143.

@golang golang locked and limited conversation to collaborators Nov 4, 2016
@rsc rsc unassigned rakyll Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants