SDKBOX Play error: local reference table overflow

There is a problem with SDKBOX Play: it can’t work with more than ~72 achievements, because it crashes during init().

@nite could you take a look?

I have a game with a lot of small achievements (76) and leader boards for every level (32).
Everything was OK for a few days when there were only 72 achievements in sdkbox_config.json.
But when I added last 4 achievements, there is “local reference table overflow” error and the game crashes just after start.

The entries in sdkbox_config.json are correct, because I tried to remove some old (previously working) entries and replace them with new ones, so there were about 70 achievements, and the game worked again.

Part of logcat:

I/DEBUG   (  328): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (  328): Build fingerprint: 'Xiaomi/ferrari/ferrari:5.0.2/LRX22G/5.12.4:user/release-keys'
I/DEBUG   (  328): Revision: '0'
I/DEBUG   (  328): ABI: 'arm'
I/DEBUG   (  328): pid: 7649, tid: 7673, name: GLThread 99  >>> com.mycompany.mygame <<<
I/DEBUG   (  328): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
I/DEBUG   (  328): Abort message: 'art/runtime/indirect_reference_table.cc:113] JNI ERROR (app bug): local reference table overflow (max=512)'
I/DEBUG   (  328):     r0 00000000  r1 00001df9  r2 00000006  r3 00000000
I/DEBUG   (  328):     r4 e5a89dd8  r5 00000006  r6 00000002  r7 0000010c
I/DEBUG   (  328):     r8 00000000  r9 ab93abb0  sl abd3b3c0  fp 00000641
I/DEBUG   (  328):     ip 00001df9  sp e5a89458  lr f7461735  pc f748828c  cpsr 60070010
I/DEBUG   (  328): 
I/DEBUG   (  328): backtrace:
I/DEBUG   (  328):     #00 pc 0003a28c  /system/lib/libc.so (tgkill+12)
I/DEBUG   (  328):     #01 pc 00013731  /system/lib/libc.so (pthread_kill+52)
I/DEBUG   (  328):     #02 pc 0001434f  /system/lib/libc.so (raise+10)
I/DEBUG   (  328):     #03 pc 00010c75  /system/lib/libc.so (__libc_android_abort+36)
I/DEBUG   (  328):     #04 pc 0000f1bc  /system/lib/libc.so (abort+4)
I/DEBUG   (  328):     #05 pc 00214d3d  /system/lib/libart.so (art::Runtime::Abort()+160)
I/DEBUG   (  328):     #06 pc 000a6443  /system/lib/libart.so (art::LogMessage::~LogMessage()+1322)
I/DEBUG   (  328):     #07 pc 001519e3  /system/lib/libart.so (art::IndirectReferenceTable::Add(unsigned int, art::mirror::Object*)+346)
I/DEBUG   (  328):     #08 pc 001c40cb  /system/lib/libart.so (art::JNI::GetObjectClass(_JNIEnv*, _jobject*)+282)
I/DEBUG   (  328):     #09 pc 00360ff5  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::GetClassObjectFromObject(_jobject*, _JNIEnv*)+24)
I/DEBUG   (  328):     #10 pc 003614d9  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::GetJNIMethodInfo(_jobject*, char const*, char const*, _JNIEnv*)+28)
I/DEBUG   (  328):     #11 pc 00361f8d  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::NewJSON(sdkbox::Json const&, _JNIEnv*)+288)
I/DEBUG   (  328):     #12 pc 00361edd  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::NewJSON(sdkbox::Json const&, _JNIEnv*)+112)
I/DEBUG   (  328):     #13 pc 00361f6f  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::NewJSON(sdkbox::Json const&, _JNIEnv*)+258)
I/DEBUG   (  328):     #14 pc 00356bed  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (bool sdkbox::JNIInvoke<bool, sdkbox::Json>(_jobject*, char const*, sdkbox::Json)+64)
I/DEBUG   (  328):     #15 pc 00356d1f  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxPlayProxy::nativeInit(sdkbox::Json const&)+222)
I/DEBUG   (  328):     #16 pc 00357345  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxPlayWrapperEnabled::nativeInit(sdkbox::Json const&)+36)
I/DEBUG   (  328):     #17 pc 003577d9  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxPlayWrapperEnabled::init(char const*)+160)
I/DEBUG   (  328):     #18 pc 00357479  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (sdkbox::PluginSdkboxPlay::init()+12)
I/DEBUG   (  328):     #19 pc 0033b7e3  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (AppDelegate::applicationDidFinishLaunching()+14)
I/DEBUG   (  328):     #20 pc 0036260d  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (cocos2d::Application::run()+6)
I/DEBUG   (  328):     #21 pc 00363501  /data/app/com.mycompany.mygame-1/lib/arm/libcocos2dcpp.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+92)
I/DEBUG   (  328):     #22 pc 004170a9  /data/dalvik-cache/arm/data@app@com.mycompany.mygame-1@base.apk@classes.dex

Ok let me create a sample game with more than 72 achievements and try it out.

You don’t need “real” achievements (in google developer console). You can just add fake entries into json file - it’s far less time consuming.

I tested this way with other game and the number is not precise 72 or 76 as I tought before. It looks like it is combined number of leaderboards and achievements, because the other game crashes with 99 achievements but work with 98 (you can have up to 200 in google, if each one is 5 exp points).

I’m having the same problem with 45 achievements and 15 leaderboards.

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

  JNI ERROR (app bug): local reference table overflow (max=512)
 local reference table dump:
   Last 10 entries (of 512):
   511: 0x12d79120 java.lang.String "... (18 chars)
   510: 0x12cb59e0 java.lang.Class<com.sdkbox.plugin.JSON>
   509: 0x12d790e0 java.lang.String "id"
   508: 0x12d0df40 java.util.HashMap
   507: 0x700bb088 java.lang.Class<java.util.HashMap>
   506: 0x12d0de80 java.util.HashMap
   505: 0x700bb088 java.lang.Class<java.util.HashMap>
   504: 0x12d0ddc0 java.util.HashMap
   503: 0x700bb088 java.lang.Class<java.util.HashMap>
   502: 0x12d0dd00 java.util.HashMap
   Summary:
 5 of java.util.HashMap (5 unique instances)
 1 of com.sdkbox.plugin.PluginSdkboxAds
16 of java.util.HashMap (16 unique instances)
 1 of com.sdkbox.plugin.SdkboxGPGAchievements
40 of java.util.HashMap (40 unique instances)
 3 of java.lang.String (3 unique instances)
 7 of java.util.HashMap (7 unique instances)
 1 of com.sdkbox.plugin.SdkboxGPGLeaderboards
 3 of java.util.HashMap (3 unique instances)
 1 of com.sdkbox.plugin.PluginChartboost
 9 of java.util.HashMap (9 unique instances)
 2 of com.sdkbox.plugin.JSON (2 unique instances)
 1 of java.util.HashMap
 2 of com.sdkbox.plugin.JSON (2 unique instances)
 1 of com.sdkbox.plugin.SdkboxGPGAuthentication
16 of java.util.HashMap (16 unique instances)
 1 of com.sdkbox.plugin.PluginAdColony
55 of java.util.HashMap (55 unique instances)
 1 of com.sdkbox.services.XMLHttpRequest
 1 of java.util.HashMap
 1 of com.sdkbox.services.XMLHttpRequest
63 of java.util.HashMap (63 unique instances)
 1 of java.lang.String
14 of java.util.HashMap (14 unique instances)
17 of java.lang.Class (6 unique instances)
 1 of com.sdkbox.plugin.JSON[] (45 elements)
 4 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON[] (15 elements)
85 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON[] (15 elements)
 6 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON[] (45 elements)
 3 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON
26 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.PluginAdMob
10 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON[] (15 elements)
14 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON[] (45 elements)
 5 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON[] (45 elements)
49 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON[] (1 elements)
 9 of java.lang.Class (1 unique instances)
 1 of com.sdkbox.plugin.JSON[] (3 elements)
25 of java.lang.Class (7 unique instances)
 1 of com.sdkbox.plugin.JSON[] (2 elements)
 1 of com.sdkbox.plugin.JSON[] (3 elements)

Hei,

I have fixed this issue, next release will contains my code.

Thanks for your feedback !

1 Like

Great, Thanks! :slight_smile:

I was also using SDKBox Ads. If I init Ads before Play, Play fails. If I start Play before Ads, Ads fails init with the same error. If remove Ads, Play works fine with my configuration (45 + 15) but if i add a few more achievements it fails even used alone. Other modules seem to have no influence. My Ads config was very simple with just three ad units and one placement.