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

Why some user always crash in Java_io_objectbox_query_Query_nativeRemove #1194

Open
15915763299 opened this issue Oct 30, 2024 · 5 comments
Open
Labels
bug Something isn't working more info required Further information is requested

Comments

@15915763299
Copy link

15915763299 commented Oct 30, 2024

the main thread stack:

0 | #00 pc 000000000016de8c /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
-- | --
1 | #01 pc 0000000000173964 /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
2 | #02 pc 00000000001708dc /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
3 | #03 pc 000000000016ffec /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
4 | #04 pc 0000000000167e7c /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
5 | #05 pc 00000000000f5870 /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
6 | #06 pc 00000000000f73b0 /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
7 | #07 pc 00000000000ef248 /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
8 | #08 pc 0000000000139b84 /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so
9 | #09 pc 00000000000b4280 /data/app/com.jglive.xinlian-vX1snvu_bJtycHbpp_MNYg==/lib/arm64/libobjectbox-jni.so (Java_io_objectbox_query_Query_nativeRemove+68)
10 | #10 pc 0000000000152354 /apex/com.android.runtime/lib64/libart.so
11 | #11 pc 0000000000149338 /apex/com.android.runtime/lib64/libart.so
12 | #12 pc 00000000001581b8 /apex/com.android.runtime/lib64/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+256)
13 | #13 pc 000000000030014c /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPNS_11ShadowFrameEtPNS_6JValueE+388)
14 | #14 pc 00000000002fb41c /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+916)
15 | #15 pc 00000000005d365c /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+652)
16 | #16 pc 0000000000143818 /apex/com.android.runtime/lib64/libart.so
17 | #17 pc 00000000005d5d08 /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+1172)
18 | #18 pc 0000000000143918 /apex/com.android.runtime/lib64/libart.so
19 | #19 pc 00000000005d6514 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+1140)
20 | #20 pc 0000000000143998 /apex/com.android.runtime/lib64/libart.so
21 | #21 pc 00000000005d516c /apex/com.android.runtime/lib64/libart.so (MterpInvokeInterface+1756)
22 | #22 pc 0000000000143a18 /apex/com.android.runtime/lib64/libart.so
23 | #23 pc 00000000005d396c /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1436)
24 | #24 pc 0000000000143818 /apex/com.android.runtime/lib64/libart.so
25 | #25 pc 00000000005d396c /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1436)
26 | #26 pc 0000000000143818 /apex/com.android.runtime/lib64/libart.so
27 | #27 pc 00000000005d396c /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1436)
28 | #28 pc 0000000000143818 /apex/com.android.runtime/lib64/libart.so
29 | #29 pc 00000000005d516c /apex/com.android.runtime/lib64/libart.so (MterpInvokeInterface+1756)
30 | #30 pc 0000000000143a18 /apex/com.android.runtime/lib64/libart.so
31 | #31 pc 00000000005d396c /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1436)
32 | #32 pc 0000000000143818 /apex/com.android.runtime/lib64/libart.so
33 | #33 pc 00000000005d516c /apex/com.android.runtime/lib64/libart.so (MterpInvokeInterface+1756)
34 | #34 pc 0000000000143a18 /apex/com.android.runtime/lib64/libart.so
35 | #35 pc 00000000002d0a78 /apex/com.android.runtime/lib64/libart.so
36 | #36 pc 00000000005c2994 /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1016)
37 | #37 pc 000000000015246c /apex/com.android.runtime/lib64/libart.so
38 | #38 pc 00000000003d8d5c /system/framework/arm64/boot.oat
39 | null

What dost code in "Java_io_objectbox_query_Query_nativeRemove+68" do?
Once crash happen, the same user will crash many times.

my code:

    private fun deleteExpireTimeData() {
        try {
            val splitTime =
                System.currentTimeMillis() / 1000 - AppConfigManager.getOnlineMaxSaveTime()
            val count = getOnlineUserBox().query()
                .less(OnlineNoticeUserEntity_.pullServerTime, splitTime)
                .build()
                .remove()
        } catch (e: Exception) {
            val dir = onlineDataDir()
            FileUtils.delete(dir)
        }
    }

It's crash when 'remove' invoke

@15915763299 15915763299 added the bug Something isn't working label Oct 30, 2024
@greenrobot-team
Copy link
Member

greenrobot-team commented Oct 30, 2024

Thanks for reporting! It would really help if you can provide the info requested in the bug report template, most importantly which version of ObjectBox is used by your project?

Anyhow, the most common cause for this, that we are aware of, is that the Store is closed in a different thread while the remove query is still running.

Note: I labeled this issue with "more info required" so it will auto-close in a few days if there are no follow-up comments.

@greenrobot-team greenrobot-team added the more info required Further information is requested label Oct 30, 2024
@github-actions github-actions bot removed the more info required Further information is requested label Oct 31, 2024
@15915763299
Copy link
Author

Build info
ObjectBox version: [3.8.0]
OS: [Android 28/29/30 ]
Device/ABI/architecture: [arm64-v8a / armeabi-v7a / armeabi(8 Cores)]

Recently, it's crash 101 times in 3 phones as below:
HUAWEI EVR-AN00, Android 29
vivo V1945A, Android 28
OPPO PECM30, Android 31
image

Steps to reproduce
when the app launch and invoke 'remove' method`

    private fun deleteExpireTimeData() {
        try {
            val splitTime =
                System.currentTimeMillis() / 1000 - AppConfigManager.getOnlineMaxSaveTime()
            val count = getOnlineUserBox().query()
                .less(OnlineNoticeUserEntity_.pullServerTime, splitTime)
                .build()
                .remove()
        } catch (e: Exception) {
            val dir = onlineDataDir()
            FileUtils.delete(dir)
        }
    }

the stack traces is in the first message

@15915763299
Copy link
Author

objectboxVersion = '3.8.0'

implementation "io.objectbox:objectbox-kotlin:$objectboxVersion"
normalImplementation "io.objectbox:objectbox-android:$objectboxVersion"
forTestImplementation "io.objectbox:objectbox-android-objectbrowser:$objectboxVersion"
kapt "io.objectbox:objectbox-processor:$objectboxVersion"

classpath("io.objectbox:objectbox-gradle-plugin:$objectboxVersion")

@greenrobot-team
Copy link
Member

Based on the symbolized crash dump ending in LMDB code, this likely is as I suspected because the Store gets closed while a query is running.

The latest release has improvements for that case. My recommendation is to update to the latest version (4.0.3 as of 2024-11-04).

Note: I labeled this issue with "more info required" so it will auto-close in a few days if there are no follow-up comments.

@greenrobot-team greenrobot-team added the more info required Further information is requested label Nov 4, 2024
@15915763299
Copy link
Author

Thanks, I will try it in next version of our app.

@github-actions github-actions bot removed the more info required Further information is requested label Nov 5, 2024
@greenrobot-team greenrobot-team added the more info required Further information is requested label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more info required Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants