我创建了一个使用IntentServices访问数据库的应用程序(在我的案例中是SQLCipher)。我使用IntentService
对象在调用者和Parcelable
之间发送。去年一切运行良好,但在Android 5.0发布后,我的应用程序在尝试启动IntentServices(或与IntentService生命周期有任何关系的操作)时开始使用SIGSEGV崩溃。
03-04 14:54:55.612 7739 7739 E AndroidRuntime: FATAL EXCEPTION: main
03-04 14:54:55.612 7739 7739 E AndroidRuntime: Process: open.menthal, PID: 7739
03-04 14:54:55.612 7739 7739 E AndroidRuntime: java.lang.RuntimeException: Unable to create service open.menthal.services.DBServiceManipulator: java.lang.IllegalStateException: Parcel has been finalized!
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:2741)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.app.ActivityThread.access$1800(ActivityThread.java:144)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1361)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5221)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Parcel has been finalized!
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.os.BinderProxy.transactNative(Native Method)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.os.BinderProxy.transact(Binder.java:496)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.app.ActivityManagerProxy.serviceDoneExecuting(ActivityManagerNative.java:3527)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:2734)
03-04 14:54:55.612 7739 7739 E AndroidRuntime: ... 9 more
有时我也会得到异常来源的代码行,但它并没有真正帮助。它指向mContex.startService(mIntent)
,其余代码看起来像这样:
mIntent = new Intent(mContext, EventQueueIntentService.class);
mIntent.putExtra("command", EventQueue.SEND);
mIntent.putExtra("sender",TAG);
mIntent.putExtra("priority", EventQueue.Priority.LOW);
mContext.startService(mIntent);
此手机未植根,我无法获得完整的Tombstone
。我跑了adb bugreport
,但它包含了太多的个人数据。
我通常也只得到一堆堆栈/回溯:
03-06 09:58:19.095 20720 25274 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x10 in tid 25274 (IntentService[D)
NATIVE
CRASH
03-06 09:58:19.152 25346 25346 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-06 09:58:19.152 25346 25346 I DEBUG : Build fingerprint: 'google/hammerhead/hammerhead:5.0.1/LRX22C/1602158:user/release-keys'
03-06 09:58:19.152 25346 25346 I DEBUG : Revision: '11'
03-06 09:58:19.152 25346 25346 I DEBUG : ABI: 'arm'
03-06 09:58:19.153 25346 25346 I DEBUG : pid: 20720, tid: 25274, name: IntentService[D >>> open.menthal <<<
03-06 09:58:19.153 25346 25346 I DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10
03-06 09:58:19.169 25346 25346 I DEBUG : r0 00000000 r1 00000001 r2 00000000 r3 00000000
03-06 09:58:19.169 25346 25346 I DEBUG : r4 9ea6f9bc r5 00000001 r6 00000000 r7 13154a80
03-06 09:58:19.169 25346 25346 I DEBUG : r8 00000001 r9 99d5b400 sl 6fe2a4d8 fp 12c003a0
03-06 09:58:19.170 25346 25346 I DEBUG : ip b6c07e6c sp 9ea6f980 lr b6e6df55 pc b6bfbdf0 cpsr 600f0030
03-06 09:58:19.170 25346 25346 I DEBUG :
03-06 09:58:19.170 25346 25346 I DEBUG : backtrace:
03-06 09:58:19.170 25346 25346 I DEBUG : #00 pc 00022df0 /system/lib/libbinder.so (int android::Parcel::writeAligned<int>(int)+3)
03-06 09:58:19.170 25346 25346 I DEBUG : #01 pc 0007ff51 /system/lib/libandroid_runtime.so
03-06 09:58:19.171 25346 25346 I DEBUG : #02 pc 000b0da7 /data/dalvik-cache/arm/system@framework@boot.oat
03-06 09:58:19.626 25346 25346 W debuggerd: type=1400 audit(0.0:3437): avc: denied { read } for name="kgsl-3d0" dev="tmpfs" ino=6028 scontext=u:r:debuggerd:s0 tcontext=u:object_r:gpu_device:s0 tclass=chr_file
03-06 09:58:19.626 25346 25346 W debuggerd: type=1400 audit(0.0:3438): avc: denied { read } for name="kgsl-3d0" dev="tmpfs" ino=6028 scontext=u:r:debuggerd:s0 tcontext=u:object_r:gpu_device:s0 tclass=chr_file
03-06 09:58:19.714 25346 25346 I DEBUG :
03-06 09:58:19.714 25346 25346 I DEBUG : Tombstone written to: /data/tombstones/tombstone_01
03-06 09:58:19.715 745 1918 E SharedPreferencesImpl: Couldn't create directory for SharedPreferences file shared_prefs/log_files.xml
03-06 09:58:19.716 745 810 I BootReceiver: Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
03-06 09:58:19.733 745 834 W InputDispatcher: channel '312729e open.menthal/open.menthal.activities.DrawerActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
03-06 09:58:19.733 745 834 E InputDispatcher: channel '312729e open.menthal/open.menthal.activities.DrawerActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
03-06 09:58:19.734 745 1236 I WindowState: WIN DEATH: Window{312729e u0 open.menthal/open.menthal.activities.DrawerActivity}
03-06 09:58:19.734 745 1236 W InputDispatcher: Attempted to unregister already unregistered input channel '312729e open.menthal/open.menthal.activities.DrawerActivity (server)'
03-06 09:58:19.751 195 195 I Zygote : Process 20720 exited due to signal (11)
03-06 09:58:19.771 745 761 I ActivityManager: Process open.menthal (pid 20720) has died
问题似乎与IntentService生命周期有某种关系。唯一可能在这里失败的包裹是IBinder使用的包裹。
有人可以为我提供搜索解决方案的方向吗?
谢谢, 约翰尼