Chartboost listeners : "too much recursion" on Android

Chartboost listeners : "too much recursion" on Android
0.0 0

#1

Hello,

I’m integrating Chartboost with SDKBox on my Cocos2D-3.7 JS project on Android. I’m able to see the ads, however I have an issue with the listeners. Instead of calling them, the app logs “JS: < no filename=“filename” >:0:too much recursion”.

Here is how I set the listener (called only once of course):

sdkbox.PluginChartboost.init();
sdkbox.PluginChartboost.setListener({
  onChartboostDisplay: function() { cc.log("CB Displayed"); }
});

Then I show an ad:

sdkbox.PluginChartboost.show("Default");

Here are the logs from app initialization to the “recursion” issue (perhaps it will help). I also have the IAP plugin installed.

D/dalvikvm(32161): Trying to load lib /data/app-lib/com.johnsmith.mygamedeluxe-1/libcocos2djs.so 0x43d91c70
D/houdini(32161): [32161] Warning error (ID:0x01400486).
D/houdini(32161): [32161] Loading library(version: 4.0.8.45720 RELEASE)... successfully.
D/dalvikvm(32161): Added shared lib /data/app-lib/com.johnsmith.mygamedeluxe-1/libcocos2djs.so 0x43d91c70
D/JniHelper(32161): JniHelper::setJavaVM(0x6d2b6c24), pthread_self() = 1073954880
D/main(32161): cocos_android_app_init
D/TextView(32161): Constructor - Got Res id for appearance for textColorPrimaryInverse
W/ResourceType(32161): Skipping entry 0x1060003 in package table 0 because it is not complex!
D/TextView(32161): Constructor - Got appearance for textColorPrimaryInverse
D/TextView(32161): Constructor -- Got mEditTextBackgroundColor
D/Cocos2dxActivity(32161): model=K011
D/Cocos2dxActivity(32161): product=WW_K011
D/Cocos2dxActivity(32161): isEmulator=false
I/ufoGralloc(32161): Hello, this is UFO GRALLOC/Intel Corporation
D/(32161): droid_create_context : config id = 10 conf->NativeVisualID=4
D/(32161): Pixel Format : GGL_PIXEL_FORMAT_RGB_565
I/(32161): Requested context : GLES 2.0
D/(32161): Pixel Format : GGL_PIXEL_FORMAT_RGB_565
D/cocos2d-x debug info(32161): {
D/cocos2d-x debug info(32161): 	gl.supports_vertex_array_object: true
D/cocos2d-x debug info(32161): 	gl.supports_BGRA8888: false
D/cocos2d-x debug info(32161): 	gl.supports_ATITC: false
D/cocos2d-x debug info(32161): 	gl.supports_S3TC: true
D/cocos2d-x debug info(32161): 	cocos2d.x.version: cocos2d-x-3.7
D/cocos2d-x debug info(32161): 	gl.supports_discard_framebuffer: true
D/cocos2d-x debug info(32161): 	cocos2d.x.compiled_with_profiler: false
D/cocos2d-x debug info(32161): 	gl.supports_PVRTC: false
D/cocos2d-x debug info(32161): 	cocos2d.x.build_type: DEBUG
D/cocos2d-x debug info(32161): 	gl.renderer: Intel(R) HD Graphics for BayTrail
D/cocos2d-x debug info(32161): 	gl.supports_ETC1: true
D/cocos2d-x debug info(32161): 	cocos2d.x.compiled_with_gl_state_cache: true
D/cocos2d-x debug info(32161): 	gl.version: OpenGL ES 3.0 - Build CL-260519-CI-15.33-24169
D/cocos2d-x debug info(32161): 	gl.supports_NPOT: true
D/cocos2d-x debug info(32161): 	gl.max_texture_units: 32
D/cocos2d-x debug info(32161): 	gl.vendor: Intel
D/cocos2d-x debug info(32161): 	gl.max_texture_size: 4096
D/cocos2d-x debug info(32161): }
D/CocosPlayClient.cpp(32161): isEnabled = 0
D/CocosPlayClient.cpp(32161): isDemo = 0
D/CocosPlayClient.cpp(32161): isNotifyFileLoadedEnabled = 0
W/dalvikvm(32161): dvmFindClassByName rejecting 'org/cocos2dx/lib/Cocos2dxLocalStorage'
D/cocos2d-x debug info(32161): cocos2d: fullPathForFilename: No file found at script/jsb_boot.jsc. Possible missing file.
D/cocos2d(32161): android build version:19
D/cocos2d-x debug info(32161): JS: frame width    1280
D/cocos2d-x debug info(32161): JS: frame height    736
I/SDKBox(32161): class name : ----com/sdkbox/plugin/SDKBoxIAPGooglePlay----
E/sdkbox(32161): getFingerprintString(build): 0a000000a000
E/sdkbox(32161): getFingerprintString(androidid): 5373d01ece581278
E/sdkbox(32161): getFingerprintString(macaddress): 1c:b7:2c:23:49:cf
D/IabHelper(32161): Querying owned items, item type: inapp
D/IabHelper(32161): Package name: com.johnsmith.mygamedeluxe
D/IabHelper(32161): Calling getPurchases with continuation token: null
D/SDKBox IAPGooglePlay(32161): Requesting Products
D/IabHelper(32161): Owned items response: 0
D/IabHelper(32161): Continuation token: null
D/IabHelper(32161): Querying SKU details.
D/SDKBox IAPGooglePlay(32161): NetWork reachable : true
D/SDKBox IAPGooglePlay(32161): Please retry in a few seconds.
D/IabHelper(32161): Ending async operation: refresh inventory
D/cocos2d-x debug info(32161): JS: switch ad network
D/cocos2d-x debug info(32161): JS: [AdCenter] Init Chartboost
D/PluginFactory(32161): Java class name of plugin PluginChartboost is : com/sdkbox/plugin/PluginChartboost
I/SDKBox(32161): class name : ----com/sdkbox/plugin/PluginChartboost----
D/Chartboost(32161): Register Chartboost
D/IabHelper(32161): Querying owned items, item type: subs
D/IabHelper(32161): Package name: com.johnsmith.mygamedeluxe
D/IabHelper(32161): Calling getPurchases with continuation token: null
D/IabHelper(32161): Owned items response: 0
D/IabHelper(32161): Continuation token: null
D/IabHelper(32161): Querying SKU details.
D/IabHelper(32161): Ending async operation: 
D/SDKBox IAPGooglePlay(32161): Query inventory finished.
D/SDKBox IAPGooglePlay(32161): Query inventory was successful.
D/SDKBox IAPGooglePlay(32161): Got product details: []
D/SDKBox IAPGooglePlay(32161): GooglePlay Request result : 0 msg : Product request successful data :[]
I/dalvikvm(32161): Total arena pages for JIT: 11
D/cocos2d-x debug info(32161): create rendererRecreatedListener for GLProgramState
D/cocos2d-x debug info(32161): create rendererRecreatedListener for GLProgramState
D/cocos2d-x debug info(32161): create rendererRecreatedListener for GLProgramState
D/dalvikvm(32161): GC_FOR_ALLOC freed 1024K, 14% free 6999K/8064K, paused 3ms, total 3ms
I/dalvikvm-heap(32161): Grow heap (frag case) to 10.466MB for 3768336-byte allocation
D/dalvikvm(32161): GC_FOR_ALLOC freed 70K, 10% free 10608K/11748K, paused 3ms, total 3ms
D/dalvikvm(32161): GC_FOR_ALLOC freed 34K, 9% free 10706K/11748K, paused 2ms, total 2ms
I/dalvikvm-heap(32161): Grow heap (frag case) to 14.086MB for 3768336-byte allocation
D/dalvikvm(32161): GC_FOR_ALLOC freed 72K, 8% free 14313K/15432K, paused 2ms, total 2ms
I/dalvikvm(32161): Total arena pages for JIT: 12
I/dalvikvm(32161): Total arena pages for JIT: 13
I/dalvikvm(32161): Total arena pages for JIT: 14
I/dalvikvm(32161): Total arena pages for JIT: 15
D/dalvikvm(32161): GC_FOR_ALLOC freed 11705K, 14% free 7008K/8064K, paused 5ms, total 5ms
D/cocos2d-x debug info(32161): JS: [AdCenter] Show ad
D/cocos2d-x debug info(32161): JS: [AdCenter] Show CB: Default
D/dalvikvm(32161): GC_FOR_ALLOC freed 1486K, 21% free 7149K/8944K, paused 3ms, total 3ms
I/dalvikvm-heap(32161): Grow heap (frag case) to 9.676MB for 2785296-byte allocation
D/dalvikvm(32161): GC_FOR_ALLOC freed 6K, 16% free 9863K/11668K, paused 3ms, total 3ms
D/dalvikvm(32161): GC_FOR_ALLOC freed <1K, 14% free 11457K/13264K, paused 2ms, total 3ms
I/dalvikvm(32161): Total arena pages for JIT: 16
D/cocos2d-x debug info(32161): JS: <no filename="filename">:0:too much recursion

I’m on:

Cocos2D-X-3.7 (JS)
Android 4.4.2
NDK r10c
SDKBox 0.5.6.11
    Chartboost 1.2.1.0
    IAP 1.2.1.0

Has anyone a guess of what’s causing this? Perhaps this topic can help (although the stack quota is already 500000).


#2

I’m having a very similar problem with my game on Android. I’m using the IAP plugin and the Vungle plugin, and I get a similar error in a callback after showing a Vungle ad. So this might be a SDKBOX bug and not a Chartboost bug. Everything is working great on iOS.

08-13 19:07:25.610: D/cocos2d-x debug info(15148): JS: <no filename="filename">:0:too much recursion

It happens when it should be calling the “onVungleAdViewed” listener function:

this.listener = {
  onVungleStarted: function() {
    return cc.log('onVungleStarted');
  },
  onVungleFinished: function() {
    return cc.log('onVungleFinished');
  },
  onVungleAdViewed: function(isComplete) {
    cc.log('onVungleAdViewed: ' + isComplete);
  }
};
sdkbox.PluginVungle.setListener(this.listener);

SDKBOX Versions:

iap
    v1.2.0.1
        (installed) sdkbox-iap_v1.2.0.1
    v1.2.1.0
        (available) sdkbox-iap_v1.2.1.0_for_v2.tar.gz
        (installed) sdkbox-iap_v1.2.1.0.tar.gz
    v1.2.1.1
        (installed) sdkbox-iap_v1.2.1.1
    v1.2.1.8
        (installed) sdkbox-iap_v1.2.1.8
vungle
    v1.2.1.0
        (available) sdkbox-vungle_v1.2.1.0_for_v2.tar.gz
        (installed) sdkbox-vungle_v1.2.1.0.tar.gz
    v1.2.1.8
        (installed) sdkbox-vungle_v1.2.1.8
SDKBOX
    v0.5.6.11

Any help would be greatly appreciated since this issue blocks our Android launch. (Users can watch incentivised ads, but get no reward– bummer!)

Thanks!


#3

I’m looking into this issue right now.


#4

I found the issue, working on the fix right now, should be able to release a fix next monday, I’ll send out nightly build for you guys.


#5

This is working now, thanks a lot!

What was causing it? I actually ran into the same exception when trying to use the Cocos2dxJavascriptJavaBridge.evalString function on another project.


#6

It’s caused by invoking spidermonkey from another thread.
spidermonkey like cocos2d-x don’t support multithreading that well.

You can try wrap code inside, to make sure the code execute in Cocos2d-x thread

cocos2d::Director::getInstance()->getScheduler()->performFunctionInCocosThread([=](){
}

See example here


#7

Oh yes, indeed, it is a thread issue. I actually code this in Java, not C++, so here is what I finally did (if it can help someone someday):

Cocos2dxGLSurfaceView.getInstance().queueEvent(new Runnable() {
    @Override
    public void run() {
        Cocos2dxJavascriptJavaBridge.evalString("cc.log(\"Win!\")");
    }
});

Also, the doc states that one can use runOnGLThread (this is not an Android API).

Thanks again Nite!


#8

Hi,

I’m experiencing the same issue but i think the context is different and I don’t know what I can do.

I have an android application with 2 activities A and B

A is a home app with menu, preference, etc and it’s in android native ui

B is a cocos2dx-js activity and this is launch from the activity A.

In the ui thread of B there is an android ui button that allow to switch back to A to change some preferences before coming back to B.

When the application switch between activities : A -> B -> A -> B, the cocos2d-x context seems the same but i’ve got the “too much recursion” issue.

Any ideas to solve this ?


#9

I used Facebook plugin and got this error. Can you tell me where to put your snippet code? Thank you very much!


#11

You have to put the snippet around the code that is executing your Javascript. But if it’s in a SDKBox plugin, you have to modify its source code. I don’t know if you can do that.


#12

Hi, I got the same problem. How do you resolve this issue?


#13

usually that means something wrong with the js binding code. What’s your cocos2d-js version?


#14

I use Cocos2dx-Js version 3.14.1