-
Notifications
You must be signed in to change notification settings - Fork 302
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
JNI ERROR (app bug): global reference table overflow on executing many instrumentation tests in a row #1080
Comments
Thanks for this detailed report! I quickly noticed that many classes called converter are in the reference table dump. Do your |
Thank you for your quick response! Yes, our classes use PropertyConverters, e.g. one for converting java.time.LocalDateTime into Long. See our sample implementation:
|
@greenrobot-team Is the info I provided enough to replicate this problem or do you need more to fully investigate? |
@Faltenreich Yes, thank you. I was on holiday and currently some other tasks have priority, but will look into this! |
Just had a quick look: from my initial testing it appears that The crash log also indicates there are Edit: not sure this is right. The test app is killed after each test. How do you run your tests? Using Gradle tasks or adb commands? Maybe try to create/destroy BoxStore using |
Sadly we have the same outcome if we create and destroy the BoxStore before and after every test via an IntentsTestRule:
We run our tests via Gradle tasks, e.g. |
Thanks! We had a closer look as well and could verify the memory leak. The converter classes are indeed not freed up after closing the store. We'll update this issue when a fix is ready to be shipped. |
Release |
Version 3.2.1 fixes our test suite and all instrumentation tests are subsequently succeeding again! Thank you very much for your effort and keep up the good work! <3 |
Describe the bug
We have an app with around 50-60 instrumentation tests. Most of them use an underlying and temporary ObjectBox database. After a certain amount of tests in a row, we run reproducibly into a JNI Error. This error halts our test suite and therefore our whole CI pipeline. The error occurs on different tests but always after a certain number of instrumentation tests.
We assume that this JNI Error is caused by ObjectBox as we do not handle any native code and most of the classes from the log have something to do with this otherwise awesome library, e.g. entities or property converters. It seems that ObjectBox does hold some global references that are not being freed between tests.
We tried to setup/teardown the in-memory database before for every test and the whole test suite (via the CustomTestRunner down below), but this did not solve our problem.
Basic info:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Less unique instances of ObjectBox-related classes and therefore no global reference table overflow anymore when running many instrumentation tests.
Code
Logs, stack traces
Additional context
Our current workaround is to run our instrumentation tests in chunks, so that the JNI Error does not appear after a certain amount of tests.
Thanks in advance and best regards!
The text was updated successfully, but these errors were encountered: