You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

UI与后台服务共用Realm触发SIGABRT崩溃问题求助

Realm跨UI与后台服务共用时触发SIGABRT崩溃

我最近在尝试让UI和后台服务共用同一个Realm实例时,触发了SIGABRT崩溃,崩溃日志如下:

05-20 14:39:35.016 11464 11464 F DEBUG : Build fingerprint: 'google/sdk_google_phone_x86/generic_x86:7.1.1/NYC/4729347:userdebug/test-keys' 
05-20 14:39:35.017 11464 11464 F DEBUG : Revision: '0' 
05-20 14:39:35.017 11464 11464 F DEBUG : ABI: 'x86' 
05-20 14:39:35.017 11464 11464 F DEBUG : pid: 11427, tid: 11452, name: est.aps.tracker >>> fr.test.aps.tracker <<< 
05-20 14:39:35.019 11464 11464 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 
05-20 14:39:35.019 11464 11464 F DEBUG : eax 00000000 ebx 00002ca3 ecx 00002cbc edx 00000006 
05-20 14:39:35.019 11464 11464 F DEBUG : esi 8977f978 edi 8977f920 
05-20 14:39:35.019 11464 11464 F DEBUG : xcs 00000073 xds 0000007b xes 0000007b xfs 0000003b xss 0000007b 
05-20 14:39:35.019 11464 11464 F DEBUG : eip ae2f1424 ebp 8977f778 esp 8977f71c flags 00200296 
05-20 14:39:35.028 11464 11464 F DEBUG : 
05-20 14:39:35.028 11464 11464 F DEBUG : backtrace: 
05-20 14:39:35.028 11464 11464 F DEBUG : #00 pc ffffe424 [vdso:ae2f1000] (__kernel_vsyscall+16) 
05-20 14:39:35.028 11464 11464 F DEBUG : #01 pc 0007a03c /system/lib/libc.so (tgkill+28) 
05-20 14:39:35.028 11464 11464 F DEBUG : #02 pc 00075885 /system/lib/libc.so (pthread_kill+85) 
05-20 14:39:35.028 11464 11464 F DEBUG : #03 pc 0002785a /system/lib/libc.so (raise+42) 
05-20 14:39:35.028 11464 11464 F DEBUG : #04 pc 0001ee36 /system/lib/libc.so (abort+86) 
05-20 14:39:35.030 11464 11464 F DEBUG : #05 pc 0046bab4 /data/app/fr.test.aps-1/lib/x86/librealm-wrappers.so (_ZN9__gnu_cxx27__verbose_terminate_handlerEv+452) 
05-20 14:39:35.034 11464 11464 F DEBUG : #06 pc 00433b17 /data/app/fr.test.aps-1/lib/x86/librealm-wrappers.so (_ZN10__cxxabiv111__terminateEPFvvE+23) 
05-20 14:39:35.034 11464 11464 F DEBUG : #07 pc 00433baf /data/app/fr.test.aps-1/lib/x86/librealm-wrappers.so (_ZSt9terminatev+31) 
05-20 14:39:35.034 11464 11464 F DEBUG : #08 pc 0046a73d /data/app/fr.test.aps-1/lib/x86/librealm-wrappers.so (execute_native_thread_routine+141) 
05-20 14:39:35.034 11464 11464 F DEBUG : #09 pc 00074fe2 /system/lib/libc.so (_ZL15__pthread_startPv+210) 
05-20 14:39:35.034 11464 11464 F DEBUG : #10 pc 0002029e /system/lib/libc.so (__start_thread+30) 
05-20 14:39:35.034 11464 11464 F DEBUG : #11 pc 0001e076 /system/lib/libc.so (__bionic_clone+70) 

为了排查这个问题,我做了一个包含单页面和混合服务的测试App:

  • 页面上有启停计数器的按钮,用ListView展示用户对象列表
  • 后台服务每5秒会在Logcat里输出计数器值(启动后需要等几秒才会开始输出)

我的需求是让服务能实时修改ListView里的计数器值,但现在遇到的核心问题是:不能同时在UI和服务中使用同一个Realm——具体来说,就是不能同时取消注释下面这两行代码:

Enable/disable usage of realm by background service: Uncomment/comment await in StartTrack method of Tracker.cs file.
Enable/disable usage of realm by UI: Uncomment/comment await in OnAppearing method of ServicePage.cs file.

另外需要注意:测试时要适配Constants.cs里的有效ROS地址、用户名和密码。


内容的提问来源于stack exchange,提问作者Mauricio

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 07:20:39