0

I created an app that uses IntentServices to access the database (in my case SQLCipher). I send that between the callers and IntentService using Parcelable objects. Everything ran fine for the last year but after Android 5.0 was released, my app started crashing with a SIGSEGV when it tried to start IntentServices (or operations that had anything to do with the IntentService lifecycle).

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

Sometimes I also get the line of code where the exception originated from but it's not really helpful. It points to the mContex.startService(mIntent) and the rest of the code looks something like this:

        mIntent = new Intent(mContext, EventQueueIntentService.class);
        mIntent.putExtra("command", EventQueue.SEND);
        mIntent.putExtra("sender",TAG);
        mIntent.putExtra("priority", EventQueue.Priority.LOW);

        mContext.startService(mIntent);

This phone isn't rooted and I can't get the full Tombstone. I ran adb bugreport but it contains a bit too much personal data. I usually also get just a piece of the stack/back trace:

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

The problem appears to be somehow related to the IntentService lifecycle. The only parcels that could fail here are the ones used by IBinder.

Can someone offer me a direction in which to search for the solution?

Thanks, Johnny

johnny_and1
  • 1
  • 1
  • 2

0 Answers0