Bug 22444 - local reference table overflow (max=512)
Summary: local reference table overflow (max=512)
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.14.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
: 23916 ()
Depends on:
Blocks:
 
Reported: 2014-08-28 08:37 UTC by renan jegouzo
Modified: 2015-12-15 08:20 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
lref log (3.91 MB, text/plain)
2014-08-28 09:15 UTC, renan jegouzo
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description renan jegouzo 2014-08-28 08:37:18 UTC
after running a little time my app goes into this crash:
and on what I've seen in the forum, it looks like some native doesn't release some local ref.

E/dalvikvm(15056): JNI ERROR (app bug): local reference table overflow (max=512)
W/dalvikvm(15056): JNI local reference table (0x82a94820) dump:
W/dalvikvm(15056):   Last 10 entries (of 512):
W/dalvikvm(15056):       511: 0x42e1a9c0 byte[] (16384 elements)
W/dalvikvm(15056):       510: 0x4212f268 java.util.zip.ZipFile$ZipInflaterInputStream
W/dalvikvm(15056):       509: 0x415ffca8 java.lang.Class<android.graphics.BitmapFactory>
W/dalvikvm(15056):       508: 0x4212f268 java.util.zip.ZipFile$ZipInflaterInputStream
W/dalvikvm(15056):       507: 0x430d6700 java.lang.String "Content/book/cha... (69 chars)
W/dalvikvm(15056):       506: 0x430d5b90 java.lang.String "Content/book/cha... (69 chars)
W/dalvikvm(15056):       505: 0x430d7d98 java.lang.String "Content/book/cha... (69 chars)
W/dalvikvm(15056):       504: 0x430d63e0 java.lang.String "Content/book/cha... (65 chars)
W/dalvikvm(15056):       503: 0x42e21bd8 java.lang.String "Content/book/cha... (65 chars)
W/dalvikvm(15056):       502: 0x430dbe20 java.lang.String "Content/book/cha... (65 chars)
W/dalvikvm(15056):   Summary:
W/dalvikvm(15056):         1 of java.lang.Class
W/dalvikvm(15056):       508 of java.lang.String (508 unique instances)
W/dalvikvm(15056):         1 of byte[] (16384 elements)
W/dalvikvm(15056):         2 of java.util.zip.ZipFile$ZipInflaterInputStream (1 unique instances)
E/dalvikvm(15056): Failed adding to JNI local ref table (has 512 entries)
I/dalvikvm(15056): "Thread-3713" prio=5 tid=18 RUNNABLE
I/dalvikvm(15056):   | group="main" sCount=0 dsCount=0 obj=0x42187e10 self=0x7d95d590
I/dalvikvm(15056):   | sysTid=15111 nice=0 sched=0/0 cgrp=apps handle=2106949912
I/dalvikvm(15056):   | state=R schedstat=( 0 0 0 ) utm=1386 stm=175 core=1
I/dalvikvm(15056):   at java.util.zip.Inflater.setFileInputImpl(Native Method)
I/dalvikvm(15056):   at java.util.zip.Inflater.setFileInput(Inflater.java:315)
I/dalvikvm(15056):   at java.util.zip.ZipFile$RAFStream.fill(ZipFile.java:485)
I/dalvikvm(15056):   at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:192)
I/dalvikvm(15056):   at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:153)
I/dalvikvm(15056):   at java.util.zip.ZipFile$ZipInflaterInputStream.read(ZipFile.java:506)
I/dalvikvm(15056):   at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
I/dalvikvm(15056):   at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:620)
I/dalvikvm(15056):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
I/dalvikvm(15056):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:634)
I/dalvikvm(15056):   at dalvik.system.NativeStart.run(Native Method)
Comment 1 Jonathan Pryor 2014-08-28 09:06:10 UTC
Please provide your app.

Alternatively, does your app cause Java exceptions to be thrown? If so, you're probably hitting Bug #22218.
Comment 2 renan jegouzo 2014-08-28 09:14:01 UTC
I haven't all the right on the app, I can't share it.
Comment 3 renan jegouzo 2014-08-28 09:15:19 UTC
Created attachment 7850 [details]
lref log
Comment 4 renan jegouzo 2014-08-28 09:18:04 UTC
I think it's something else than bug #22218, the lrefs are all strings, but filled with my asset paths inside a zipfile.
Comment 5 renan jegouzo 2014-09-01 09:25:36 UTC
where I can find older xamarin.android l ? so I can build a working version ?
Comment 6 renan jegouzo 2014-09-01 10:44:45 UTC
sorry, wrong thread, last question was for another problem..

for me, it seems like a bug in the ZipFile wrapper..  any work around ?
Comment 7 renan jegouzo 2014-09-02 11:51:52 UTC
maybe, the particularity of my code, it's that I use this code to check for each image if a localized version exist:

bool Exists(string asset) 
{
    var z=zip.GetEntry(asset);
    if(z!=null) {
        z.Dispose();
	return true;
    }
    return false;
}
Comment 8 renan jegouzo 2014-09-06 05:14:22 UTC
I have replaced the zip code by an external library  (sharpziplib), and same bug happens, so it's not the android zip wrapper that is faulty. What could be the reason for this kind of bug ? I don't think it's an exception...
Comment 10 renan jegouzo 2014-09-09 18:14:16 UTC
can you help me ? it's the last bug it stays before the release of this app, and I can't fix it by myself.
Comment 11 renan jegouzo 2014-09-09 19:29:47 UTC
I must have done a mistake, in fact, using a c# zip library fix the problem. but it too slow for my project, cause it doesn't use zipalign optimization and all that android stuffs.
Comment 12 Parmendra Kumar 2014-10-20 11:36:47 UTC
*** Bug 23916 has been marked as a duplicate of this bug. ***
Comment 13 renan jegouzo 2014-10-24 11:40:46 UTC
I'm missing this function in xamarin.android:`

Dalvik.SystemInterop.VMDebug.DumpReferenceTable();

to get some clues on what's happening
Comment 14 renan jegouzo 2014-10-24 11:42:25 UTC
the app is available here with this last bug 
https://play.google.com/store/apps/details?id=net.aestesis.because.manuchao.paid&hl=en
I couldn't retain more the launch date.
Comment 15 renan jegouzo 2014-10-24 13:40:31 UTC
it's the Bug #22218, I had a fallback with the normal openasset in case with a try..catch
I've fixed with a work around.

so it seems that in Version: 4.18.0
bug #22218 is still present.

when we will be able to use use try..catch in xamarin android ???
the bug has been found 2 months ago, it's very long to fix a crashing bug.
Comment 16 renan jegouzo 2015-12-15 08:20:17 UTC
seems OK now