Objectbox-java: DbException: Could not begin read transaction (another read transaction is still active on this thread)

Created on 16 Apr 2018  路  18Comments  路  Source: objectbox/objectbox-java

UncaughtException detected: io.objectbox.exception.DbException: Could not begin read transaction (another read transaction is still active on this thread) (error code -30783)
04-16 11:58:50.880 E/CrashHandler(24876):   at io.objectbox.BoxStore.nativeBeginReadTx(Native Method)
04-16 11:58:50.880 E/CrashHandler(24876):   at io.objectbox.BoxStore.beginReadTx(BoxStore.java:350)
04-16 11:58:50.880 E/CrashHandler(24876):   at io.objectbox.BoxStore.callInReadTx(BoxStore.java:672)
04-16 11:58:50.880 E/CrashHandler(24876):   at io.objectbox.BoxStore.callInReadTxWithRetry(BoxStore.java:620)
04-16 11:58:50.880 E/CrashHandler(24876):   at io.objectbox.query.Query.callInReadTx(Query.java:304)
04-16 11:58:50.880 E/CrashHandler(24876):   at io.objectbox.query.Query.findFirst(Query.java:174)
04-16 11:58:50.880 E/CrashHandler(24876):   at com.xiaopeng.mycarinfo.core.account.login.model.data.local.UserInfoLocalDataSource.findFirst(UserInfoLocalDataSource.java:60)
04-16 11:58:50.880 E/CrashHandler(24876):   at com.xiaopeng.mycarinfo.core.account.login.model.UserModel.getUserInfo(UserModel.java:385)
04-16 11:58:50.880 E/CrashHandler(24876):   at com.xiaopeng.mycarinfo.core.account.login.model.UserModel.getUserId(UserModel.java:634)
04-16 11:58:50.880 E/CrashHandler(24876):   at com.xiaopeng.mycarinfo.model.nfc.CommunicationClient$1.onServiceConnected(CommunicationClient.java:40)
04-16 11:58:50.880 E/CrashHandler(24876):   at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1516)
04-16 11:58:50.880 E/CrashHandler(24876):   at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1544)
04-16 11:58:50.880 E/CrashHandler(24876):   at android.os.Handler.handleCallback(Handler.java:751)
04-16 11:58:50.880 E/CrashHandler(24876):   at android.os.Handler.dispatchMessage(Handler.java:95)
04-16 11:58:50.880 E/CrashHandler(24876):   at android.os.Looper.loop(Looper.java:154)
04-16 11:58:50.880 E/CrashHandler(24876):   at android.app.ActivityThread.main(ActivityThread.java:6646)
04-16 11:58:50.880 E/CrashHandler(24876):   at java.lang.reflect.Method.invoke(Native Method)
04-16 11:58:50.880 E/CrashHandler(24876):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
04-16 11:58:50.880 E/CrashHandler(24876):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
04-16 11:58:50.881 I/crash_recorder(24876): CrashDetails:{
04-16 11:58:50.881 I/crash_recorder(24876): io.objectbox.exception.DbException: Could not begin read transaction (another read transaction is still active on this thread) (error code -30783)
04-16 11:58:50.881 I/crash_recorder(24876):     at io.objectbox.BoxStore.nativeBeginReadTx(Native Method)
04-16 11:58:50.881 I/crash_recorder(24876):     at io.objectbox.BoxStore.beginReadTx(BoxStore.java:350)
04-16 11:58:50.881 I/crash_recorder(24876):     at io.objectbox.BoxStore.callInReadTx(BoxStore.java:672)
04-16 11:58:50.881 I/crash_recorder(24876):     at io.objectbox.BoxStore.callInReadTxWithRetry(BoxStore.java:620)
04-16 11:58:50.881 I/crash_recorder(24876):     at io.objectbox.query.Query.callInReadTx(Query.java:304)
04-16 11:58:50.881 I/crash_recorder(24876):     at io.objectbox.query.Query.findFirst(Query.java:174)
04-16 11:58:50.881 I/crash_recorder(24876):     at com.xiaopeng.mycarinfo.core.account.login.model.data.local.UserInfoLocalDataSource.findFirst(UserInfoLocalDataSource.java:60)
04-16 11:58:50.881 I/crash_recorder(24876):     at com.xiaopeng.mycarinfo.core.account.login.model.UserModel.getUserInfo(UserModel.java:385)
04-16 11:58:50.881 I/crash_recorder(24876):     at com.xiaopeng.mycarinfo.core.account.login.model.UserModel.getUserId(UserModel.java:634)
04-16 11:58:50.881 I/crash_recorder(24876):     at com.xiaopeng.mycarinfo.model.nfc.CommunicationClient$1.onServiceConnected(CommunicationClient.java:40)
04-16 11:58:50.881 I/crash_recorder(24876):     at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1516)
04-16 11:58:50.881 I/crash_recorder(24876):     at and

Most helpful comment

@greenrobot
Irdeto's security reinforce include "anti-java-debug" system.
In order to prevent the hacker hack the apk by "debug". (Many software reverse engineer in China)
The bug occurs in this "anti-java-debug" mode. They fix it by modify their code of "anti-java-debug" mode.

All 18 comments

Hello I don't know why I will get this DbException

Is it reproducible?

@greenrobot Yes it is reproducible. But it only can reproduce When I use Irdeto to consolidate the apk.(https://www.irdeto.com)
consolidating the apk meaning is that secure hardening on android app dex.
So I want to know what factor will cause this?

@greenrobot this bug is abiogenetic

The background of this error is that, on a low level, only one a single read transaction is allowed per thread, and this rule has been violated. Usually, you should not have to worry about this, because the API manages this internally. Thus, you seem to have found a way to "trick" the API; it could be an internal error.

Does that background give you some ideas to check for anything special that your code does in this regard? If you could make it reproducible for us, we could check and probably fix faster.

PS.: What is an abiogenetic bug? Sounds cool...

@greenrobot
haha, Abiogenetic bug means the bug is not 100% happen.(occasional銆乤ccidental)
How I make it reproducible for you? This problem just happen when i use irdeto's secure hardening.
If I don't use irdeto's secure hardening, this exception will not happen

@greenrobot
secure hardening means that prevent others to decompile the apk.

Does irdeto work like proguard? For making a reproducible case, it would be best to have a stripped down demo project that we could look at.

@greenrobot is there a method to see the Objectbox's log?

There are debug flag you can enable. Not sure if that helps though...

@greenrobot
Hello
Can I send my apk(debuggable true in gradle) to you for see why crash in low level?
If I can send apk to you , which email address I can send?
there are two txt in the pictures.
In the first picture,
the upside crash txt is the apk with Irdeto security reinforce.
the bottom is the normal apk without Irdeto security reinforce.

Are there any clue in this two pictures?

securityharden

security2

@greenrobot
With Irdeto Security reinforce, the app will crash when findFirst UserInfo Entity at second time (not at first time) .

About 4 seconds between two times to findFirst userInfo entity. So I think that "only one a single read transaction is allowed per thread, and this rule has been violated" is not the cause? because I think the first transaction will end in 4 seconds. unless the first transaction is not end and the second transaction begin...

The logs you attached are interesting. Both are identical until the error. Also, both open a new transaction (TX # 4). How can we test if Irdeto introduces the bug?

Which Irdeto product are you using exactly? Is there technical information available? Does it come with options (e.g. obfuscate code yes/no) that you could experiment with?

@greenrobot
The product is apk reinforce.

"We implemented a shell to the APK, this shell dex can be used to decrypt and load the original classes.dex in APK. The purpose for the protection is to protect the Java bytecode from illegal reverse-engineering and piracy"
In short, apk reinforce is in order to prevent others to decompile the apk and see the sources code.

Above is what they explain about apk reinforce. and they don't obfuscate the code.

@greenrobot
We resolve it. It's Irdeto's bug

Just out of curiosity: what did Irdeto do to break it? Maybe that info helps someone in the future.

@greenrobot
Irdeto's security reinforce include "anti-java-debug" system.
In order to prevent the hacker hack the apk by "debug". (Many software reverse engineer in China)
The bug occurs in this "anti-java-debug" mode. They fix it by modify their code of "anti-java-debug" mode.

Was this page helpful?
0 / 5 - 0 ratings