Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[Android] [6.0.0-beta.2] local reference table overflow (max=512) #11212

Closed
schachi5000 opened this issue Feb 15, 2018 · 16 comments · Fixed by #11222
Closed

[Android] [6.0.0-beta.2] local reference table overflow (max=512) #11212

schachi5000 opened this issue Feb 15, 2018 · 16 comments · Fixed by #11222
Labels
Android Mapbox Maps SDK for Android beta blocker Blocks the next beta release

Comments

@schachi5000
Copy link

Platform: Android
Version: 6.0.0-beta.2

I've just tested the new beta version of the Mapbox Android SDK.

In our app we draw routes based on polygons. Since the last update, we get following native crash:

art/runtime/indirect_reference_table.cc:115] JNI ERROR (app bug): local reference table overflow (max=512)
art/runtime/indirect_reference_table.cc:115] local reference table dump:
art/runtime/indirect_reference_table.cc:115]   Last 10 entries (of 509):
art/runtime/indirect_reference_table.cc:115]       508: 0x133d4df0 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       507: 0x133d4dd0 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       506: 0x133d4d80 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       505: 0x133d4d70 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       504: 0x133d4d60 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       503: 0x133d4d50 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       502: 0x133d4d40 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       501: 0x133d4d30 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       500: 0x133d4d20 java.lang.Double
art/runtime/indirect_reference_table.cc:115]       499: 0x133d4d10 java.lang.Double
art/runtime/indirect_reference_table.cc:115]   Summary:
art/runtime/indirect_reference_table.cc:115]         1 of com.google.gson.JsonObject
art/runtime/indirect_reference_table.cc:115]         1 of com.mapbox.geojson.AutoValue_Polygon
art/runtime/indirect_reference_table.cc:115]         1 of com.mapbox.geojson.AutoValue_Feature
art/runtime/indirect_reference_table.cc:115]         2 of java.lang.Object[] (1 elements) (2 unique instan
art/runtime/indirect_reference_table.cc:115]         1 of java.lang.Object[] (263 elements)
art/runtime/indirect_reference_table.cc:115]         2 of java.lang.Class (2 unique instances)
art/runtime/indirect_reference_table.cc:115]         1 of java.lang.String[] (3 elements)
art/runtime/indirect_reference_table.cc:115]         3 of java.lang.String (3 unique instances)
art/runtime/indirect_reference_table.cc:115]       494 of java.lang.Double (494 unique instances)
art/runtime/indirect_reference_table.cc:115]         3 of java.util.ArrayList (3 unique instances)

The culprit here seems to be the massive amount of Points we use in a Feature (Polygon).

The worked flawlessly in version 5.4.0.

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Feb 15, 2018
@tobrun tobrun added this to the android-v6.0.0 milestone Feb 15, 2018
@tobrun
Copy link
Member

tobrun commented Feb 15, 2018

cc @osana

@osana
Copy link
Contributor

osana commented Feb 16, 2018

This is related to either change of data structures in mapbox-java:
mapbox/mapbox-java#710

and/or

DeleteLocalRef() not being called to delete the local reference that is never used later
as a result of #10920

@tobrun tobrun added the beta blocker Blocks the next beta release label Feb 16, 2018
@tobrun
Copy link
Member

tobrun commented Feb 16, 2018

I'm adding the beta blocker label so this can be retested with the beta.3,
@schachi5000 thank you for testing out the beta version!

@schachi5000
Copy link
Author

So I've spent some more time on this issue and found following things:

    public void updateSource(String sourceId, FeatureCollection featureCollection)
    {
        if (this.sources.containsKey(sourceId))
        {
            this.sources.get(sourceId).setGeoJson(featureCollection);
        }
    }

This snippet will lead to the reference table overflow reported in the issue.

    public void updateSource(String sourceId, String geoJson)
    {
        if (this.sources.containsKey(sourceId))
        {
            this.sources.get(sourceId).setGeoJson(geoJson);
        }
    }

This approach, on the other hand, works but does take a lot of time to process. Causing the UI to freeze depending on the size of the GeoJson. I guess the parsing of the String might be the issue here. Nevertheless, it does not cause a crash.

I hope this might help a bit :)

@tobrun
Copy link
Member

tobrun commented Feb 19, 2018

@schachi5000 would you be able to test out the changes from #11222?

You can test this with using the 7.0.0-SNAPSHOT dependency:

in your root build.gradle add:

allprojects {
    repositories {
        jcenter()
        maven { url "http://oss.sonatype.org/content/repositories/snapshots/" }
    }
}

and as dependency use:

compile 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.0.0-SNAPSHOT'

@schachi5000
Copy link
Author

Great. I just did a quick test and the issue seems to be resolved.
Also, some other problems regarding icons scaling are gone with the v7.0.0-SNAPSHOT.

Is v6.0.0 now obsolete on your end and what's the ETA for v7.0.0-SNAPSHOT?

@tobrun
Copy link
Member

tobrun commented Feb 20, 2018

@schachi5000 those icon scaling willbe gone with 6.0.0 as well, feel free to test that out with the 6.0.0 snapshot. thank you for validating!

@schachi5000
Copy link
Author

@tobrun no problem. Glad to be of help 👍

But could you explain what the main difference is between the snapshot of 6 and 7?
That's a little bit unclear to me atm.

@LukasPaczos
Copy link
Contributor

LukasPaczos commented Mar 14, 2018

Still seeing this issue while working on LocationLayerPlugin, using 6.0.0-beta.3. Reproducible on Xperia Z3. I wasn't able to reproduce it on a Pixel 2.

To give more context: in LocationLayerPlugin we are constantly (every couple of ms) updating GeoJsonSource with a new Point like

Point point = Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude());
source.setGeoJson(point);

/cc @osana

@LukasPaczos LukasPaczos reopened this Mar 14, 2018
@osana
Copy link
Contributor

osana commented Mar 16, 2018

sdk 6.0.0-beta.2 is still using MAS 3.0.0-beta.2
It would be great to retest after #11463 lands

@LukasPaczos
Copy link
Contributor

Fix for this issue landed with #11471.

@LukasPaczos
Copy link
Contributor

Reopening as we're still seeing the issue internally as well as reported by the users on the 6.0.0-beta.5 (see #11556).

@ivovandongen
Copy link
Contributor

@LukasPaczos We're going to need a way to reproduce this first. Had no luck with this so far. Tried to do so in 9c74aa6, but no matter how much I keep pushing the size, I don't get reference table overflows on my devices (Pixel 2 and Galaxy Nexus). Eventually, they will throw OOM, but that is to be expected at some point.

@LukasPaczos
Copy link
Contributor

Previously reopened due to #11556 similarities, but the issue itself is probably different. I can confirm that I'm unable to reproduce this one on Z3 anymore, therefore, closing.

Feel free to reopen if necessary.

@ugochirico
Copy link

I'm using 6.4.0 on my OnePlus 6 And I got the same error.
Any workaround?

09-13 16:45:22.359 17010-19397/com.andreucci.andreuccicodrive A/zygote64: indirect_reference_table.cc:256] JNI ERROR (app bug): weak global reference table overflow (max=51200)
indirect_reference_table.cc:256] weak global reference table dump:
indirect_reference_table.cc:256] Last 10 entries (of 51200):
indirect_reference_table.cc:256] 51199: 0x13640000 java.lang.Thread
indirect_reference_table.cc:256] 51198: 0x13600000 java.lang.Thread
indirect_reference_table.cc:256] 51197: 0x135c0000 java.lang.Thread
indirect_reference_table.cc:256] 51196: 0x13580000 java.lang.Thread
indirect_reference_table.cc:256] 51195: 0x13540000 java.lang.Thread
indirect_reference_table.cc:256] 51194: 0x13500000 java.lang.Thread
indirect_reference_table.cc:256] 51193: 0x134c0000 java.lang.Thread
indirect_reference_table.cc:256] 51192: 0x13480000 java.lang.Thread
indirect_reference_table.cc:256] 51191: 0x13400000 java.lang.Thread
indirect_reference_table.cc:256] 51190: 0x13440000 java.lang.Thread
indirect_reference_table.cc:256] Summary:
indirect_reference_table.cc:256] 9779 of java.lang.Class (9779 unique instances)
indirect_reference_table.cc:256] 64 of java.lang.Thread (64 unique instances)
indirect_reference_table.cc:256] 47 of java.lang.DexCache (47 unique instances)
indirect_reference_table.cc:256] 12 of dalvik.system.PathClassLoader (6 unique instances)
indirect_reference_table.cc:256] 3 of aeP (1 unique instances)
indirect_reference_table.cc:256] 2 of java.lang.ThreadGroup (2 unique instances)
indirect_reference_table.cc:256] 1 of com.google.android.gms.internal.zzcki
indirect_reference_table.cc:256] 1 of android.opengl.GLSurfaceView
indirect_reference_table.cc:256] 1 of com.mapbox.mapboxsdk.maps.NativeMapView
indirect_reference_table.cc:256] 1 of com.mapbox.mapboxsdk.maps.MapView$5
indirect_reference_table.cc:256] 1 of com.andreucci.andreuccicodrive.adapters.TomTomRouteAdapter
indirect_reference_table.cc:256] 1 of org.chromium.android_webview.AwSettings
indirect_reference_table.cc:256] 1 of org.chromium.android_webview.AwContentsClientBridge
indirect_reference_table.cc:256] 1 of org.chromium.android_webview.AwAutofillClient
indirect_reference_table.cc:256] 1 of org.chromium.android_webview.AwContents
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.input.ImeAdapterImpl
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.GestureListenerManagerImpl
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.accessibility.captioning.CaptioningController
indirect_reference_table.cc:256] 1 of agq
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.ContentUiEventHandler
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.TapDisambiguator
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.input.TextSuggestionHost
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.selection.SelectionPopupControllerImpl
indirect_reference_table.cc:256] 1 of org.chromium.android_webview.AwGLFunctor
indirect_reference_table.cc:256] 1 of aeN
indirect_reference_table.cc:256] 1 of aec
indirect_reference_table.cc:256] 1 of com.google.android.gms.ads.internal.webview.ab
indirect_reference_table.cc:256] 1 of org.chromium.android_webview.AwTracingController
indirect_reference_table.cc:256] 1 of org.chromium.android_webview.AwQuotaManagerBridge
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.ContentViewCoreImpl
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.JavascriptInjectorImpl
indirect_reference_table.cc:256] 1 of agn
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.input.SelectPopup
indirect_reference_table.cc:256] 1 of org.chromium.content.browser.selection.SmartSelectionClient
indirect_reference_table.cc:256] 1 of ad
indirect_reference_table.cc:256] 1 of com.google.android.gms.dynamite.zzh
indirect_reference_table.cc:256] 1 of java.lang.BootClassLoader
indirect_reference_table.cc:256] 1 of java.util.HashSet
indirect_reference_table.cc:256] 1 of android.net.ConnectivityThread
indirect_reference_table.cc:256]

@LukasPaczos
Copy link
Contributor

@ugochirico, all of the reoccurring issues with table overflows should be resolved with the introduction of the jni.hpp v4.0.0 that will be a part of the Maps SDK v6.6.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android beta blocker Blocks the next beta release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants