看起来这个错误是由本地代码中的bug引起的,这是由于在错误下面的“Build Fingerprint”中看到了“librealm-jni.so”的短语,这取决于Realm
库。我安装了最新版本的Realm
-- 1.2.0.
以下是错误代码:
Fatal signal 11 (SIGSEGV), code 1, fault addr 0x14c in tid 7837 (ator.app)
这里是“构建指纹(Build Fingerprint):”。
Build fingerprint: 'generic/vbox86p/vbox86p:5.0/LRX21M/buildbot11172321:userdebug/test-keys'
26643-26643/? I/DEBUG: Revision: '0'
26643-26643/? I/DEBUG: ABI: 'x86'
26643-26643/? I/DEBUG: pid: 7837, tid: 7837, name: ator.app >>> com.lockedout.app <<<
26643-26643/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x14c
26643-26643/? I/DEBUG: eax 00000148 ebx ffffffff ecx 7470d340 edx 00000002
26643-26643/? I/DEBUG: esi 00000000 edi 00000002
26643-26643/? I/DEBUG: xcs 00000023 xds 0000002b xes 0000002b xfs 00000007 xss 0000002b
26643-26643/? I/DEBUG: eip e2f6d025 ebp ffd3cd58 esp ffd3cd50 flags 00210246
26643-26643/? I/DEBUG: backtrace:
26643-26643/? I/DEBUG: #00 pc 0002a025 /data/app/com.lockedout.app-1/lib/x86/librealm-jni.so
26643-26643/? I/DEBUG: #01 pc 0009c141 /data/app/com.lockedout.app-1/lib/x86/librealm-jni.so
26643-26643/? I/DEBUG: #02 pc 0009c299 /data/app/com.lockedout.app-1/lib/x86/librealm-jni.so
26643-26643/? I/DEBUG: #03 pc 004002d3 /data/dalvik-cache/x86/data@app@com.lockedout.app-1@base.apk@classes.dex
26643-26643/? I/DEBUG: #04 pc 00000002 <unknown>
26643-26643/? I/DEBUG: Tombstone written to: /data/tombstones/tombstone_06
更新:
我将问题缩小到在调用RecyclerView.Adapter
上的notifyDataSetChanged
之后发生,但是代码在执行完这个操作后没有做任何其他事情。因此,我进一步将问题区域缩小到了 Android 的 Looper
类中的第135行:
Message msg = queue.next(); // might block
我不确定这是什么意思,但我想知道了解 Realm
内部的人可能能够说明为什么在 Looper
中引发错误。
关于错误之前在 Realm
中发生的更多变化信息:
notifyDataSetChanged
在设置在一个 RealmObject
上的 RealmChangeListener
中被触发,该对象名为 “User”。导致更改的事务从 User
的 RealmList<Item>
中删除了一个自定义的 RealmObject
,即 “Item” 对象。我知道这是因为我的代码中唯一会发生的事务和操作。这是删除 Item
的代码:
RealmSingleton.getUserInstance().executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
UserSingleton.getUser().deleteItem(mItem.getClassId());
}
});
更新:
导致错误的Realm代码确切行数为SharedGroup
中的第149行:
148 void commitAndContinueAsRead() {
149 nativeCommitAndContinueAsRead(nativePtr);
150 }
AsyncTask
的onPostExecute
回调中调用的,因此我认为这意味着它是从UI线程调用的。UserSingleton.getUser
是UI线程上的RealmObject
。在每个线程上,我的所有事务都是同步的,并且在任何RealmChangeListeners
中都没有执行任何事务。 - shoedoInBackground()
修改了User
表吗? - EpicPandaForce