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

JNI ERROR (app bug): local reference table overflow (max=512) #971

Closed
dessant opened this issue Dec 31, 2016 · 8 comments
Closed

JNI ERROR (app bug): local reference table overflow (max=512) #971

dessant opened this issue Dec 31, 2016 · 8 comments

Comments

@dessant
Copy link
Contributor

dessant commented Dec 31, 2016

From @Tungsteno74 on December 5, 2016 2:0

kivy 1.9.2dev0
android.api = 19
android.minapi = 13
android.sdk = 20
android.ndk = 9c

built with:
buildozer 0.33dev
target android_new

tested on Android 4.4.2

The error part log:

12-05 02:00:30.265 10534 10555 E dalvikvm: JNI ERROR (app bug): local reference table overflow (max=512): tbe.kivy.tbe
12-05 02:00:30.265 10534 10555 W dalvikvm: JNI local reference table (0x7b3bce18) dump:: tbe.kivy.tbe
12-05 02:00:30.265 10534 10555 W dalvikvm:   Last 10 entries (of 512):: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       511: 0x417611e8 java.lang.Class<java.lang.Class>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       510: 0x41761890 java.lang.Class<java.lang.Object>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       509: 0x417611e8 java.lang.Class<java.lang.Class>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       508: 0x41761890 java.lang.Class<java.lang.Object>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       507: 0x417611e8 java.lang.Class<java.lang.Class>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       506: 0x41761890 java.lang.Class<java.lang.Object>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       505: 0x417611e8 java.lang.Class<java.lang.Class>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       504: 0x41761890 java.lang.Class<java.lang.Object>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       503: 0x417611e8 java.lang.Class<java.lang.Class>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       502: 0x41761890 java.lang.Class<java.lang.Object>: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:   Summary:: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:       510 of java.lang.Class (3 unique instances): tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:         1 of java.lang.Object: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 W dalvikvm:         1 of java.lang.String[]: tbe.kivy.tbe
12-05 02:00:30.275 10534 10555 E dalvikvm: Failed adding to JNI local ref table (has 512 entries): tbe.kivy.tbe

Full log:
https://goo.gl/TLMiIg

The app crash immediately after the loading screen (or while loading?).
Several commits ago all work well (i tested it on summer with the same target).
The app run without crash with android as target.
I have not changed the app's code since that time.

I'm not sure that this problem is related to kivy. I noticed several minor issues even with the android target (which didn't appear before).
It could be a problem related to the build process with buildozer?

As i don't know where is exactly the piece of code that produce this error, if someone want to reproduce the error i can send the link (on request) to the closed alpha of the app on play store that i'm developing.

Copied from original issue: kivy/kivy#4769

@dessant
Copy link
Contributor Author

dessant commented Dec 31, 2016

From @Tungsteno74 on December 6, 2016 7:13

After some research what i found is that the main instance of the kivy app would seem that is instantiated in an endless loop until the JNI allocation space is saturated.
Is that correct? Someone can confirm that?

@dessant
Copy link
Contributor Author

dessant commented Dec 31, 2016

From @Tungsteno74 on December 6, 2016 7:16

I created a minimalistic application (containing only a few buttons), and seems to work without giving this problem. So, contrary to what I thought the problem could be in my application.

@dessant
Copy link
Contributor Author

dessant commented Dec 31, 2016

From @Tungsteno74 on December 9, 2016 3:35

Updated the full log in the first post.

I found that the error is 99% in the following call exception:

Exception jnius.jnius.JavaException: JavaException('Unable to find the class java/lang/reflect/Modifier',) in 'kivy.properties.dpi2px' ignored: tbe.kivy.tbe

This exception seems to be related to the use of a conversion function in metrics module: https://github.com/kivy/kivy/blob/master/kivy/metrics.py#L133

I'm my app (and in the minimalistic app) i used sp and dp functions, but only in my app i give that error.

I've checked the dpi2px used by metrics function too:
https://github.com/kivy/kivy/blob/master/kivy/properties.pyx#L236
but i'm not able to find any malfunction here (i'm not really good to fix bugs here)

Anyhow the related error exception seem have a start on this pyjinius class (or somewhere in the same module):
https://github.com/kivy/pyjnius/blob/master/jnius/reflect.py#L63
but not sure because, i'm really a crap to understand java calls and related code.

Someone have same errors with last version of kivy?

Last but not least, some expert can help me understand this kind of error? (So I can try to fix it)

many thanks

@dessant
Copy link
Contributor Author

dessant commented Dec 31, 2016

From @Tungsteno74 on December 22, 2016 19:51

Finally i found the problem!
Basically, the following command raise the previous error with SDL2

Config.set('kivy', 'window_icon', 'assets/logo_64x64.png')

This strange behaviour is not specified in the command documentation (i think should be documented, no?).
I don't know if on this implementation of Kivy is an unfixable problem or not, but what i think is that at least should be skipped in build phase considering that the error string does not help to find the problem.

I can close this error, but i'd like to receive a developer reply before.

@KeyWeeUsr
Copy link
Contributor

@dessant Kivy should be able to skip it with platform, explicitly removing such thing in Config for android, iOS, or any OS that actually doesn't like such thing. If there's a list of such OSes.

@Tungsteno74 Is there any good setting a window_icon on android can do? I mean, there are app icons, which are used later basically for everything. What reason is behind that requirement?

@Tungsteno74
Copy link

Tungsteno74 commented Jan 3, 2017

@KeyWeeUsr Ok, this is not a very important fix (or problem, what do you want) but i think that as this command is referenced in the official docs, at least this work (as expected) in the Windows OS. Basically i see that without this command the Kivy window have not an icon on the menu bar. Not very essential (as i said). The truth is that i caught that because i'm trying to fix some other bugs and testing it by jumping (like a rabbit :D) from a tool-chain to the other to check who is the most stable and in Android (the other OS that i tested and dislike it) you should remove it every time or this error can make you crazy like a stallion behind a mare in heat (but he can not touch she XD).

That's all ;).

@inclement
Copy link
Member

I guess this is really a Kivy bug, but I'm not sure quite why this problem would occur - SDL2 probably shouldn't crash, and Kivy does normally try to set its own default icon.

@inclement
Copy link
Member

Closing as stale, I haven't seen this recently and there have been many fixes since the issue was raised. It can be reopened if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants