Objectbox-java: Error: "Could not renew tx"

Created on 12 Jun 2017  路  11Comments  路  Source: objectbox/objectbox-java

Hello, I'm using ObjectBox in my Android project, but I constantly get this error and my application get Fore Close!
I'm totally confused, The error for?

This is error in logcat:
06-12 08:01:31.647 13669-13669/developers.mehran.sky E/Box: Storage error code -30783 06-12 08:01:31.654 13669-13669/developers.mehran.sky D/AndroidRuntime: Shutting down VM 06-12 08:01:31.655 13669-13669/developers.mehran.sky E/AndroidRuntime: FATAL EXCEPTION: main Process: developers.mehran.sky, PID: 13669 io.objectbox.exception.DbException: Could not renew tx at io.objectbox.Transaction.nativeRenew(Native Method) at io.objectbox.Transaction.renew(Transaction.java:119) at io.objectbox.Box.getReader(Box.java:60) at io.objectbox.Box.count(Box.java:201) at developers.mehran.sky.view.activity.SplashActivity$1.run(SplashActivity.java:44) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5349) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

All 11 comments

Could you share some code

Yes, code would help. Also is that reproducible or was it one time?

Hello, Thanks for your feedback

I'm using this code in my Application class (named: Sky.java) to initialize a BoxStore for using in other classes:
inOnCreate() ---> mBoxStore = MyObjectBox.builder().androidContext(Sky.this).build(); andHaveAMethod ----> public BoxStore getBoxStore() { return mBoxStore; }

Then in SplashActivity.java, app should know that user have(submit) any city object or no, for this, i'm using this code:
int count = ((Sky) getApplicationContext()).getBoxStore().boxFor(City.class).count();

Sometimes everything is good and app runs perfectly, but sometimes, application get force close and stop in this line.

Those code segments look fine and should work perfectly on their own. Are you also doing anything else with transactions or multi-threading?

No, That's all of my code.

I'm experiencing similar bug in numerous places (Enteties) although they are not that common for the users. I'm also using singelton and usally run the db operation on io Scheduler in my Observables.

I'm running v 0.9.9 but saw in the changelog that there were some bugfixes regarding multithreading. Could it be somehow related?

How to avoid this error in the future?

Please retest with 0.9.13-RC which fixed some bugs that may be related.

@MehranAbi Could you be so kind and retest your issue with 0.9.13? This would really help us. Thanks!

All right, I will test today, and comment the result.

Hooooray, I tested with version 0.9.13 and there is no problem in my app.
Thanks for your nice Library :)

Same here, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DJafari picture DJafari  路  29Comments

greenrobot picture greenrobot  路  43Comments

GerritDeMeulder picture GerritDeMeulder  路  20Comments

greenrobot picture greenrobot  路  47Comments

DJafari picture DJafari  路  21Comments