Java to native calls "JS: <no filename="filename">:0:too much recursion"

Java to native calls "JS: <no filename="filename">:0:too much recursion"
0.0 0

#1

Hey all,
I am working on Cocos2d-3.10 and facing some crashes consider the Android version.
I did some workarounds and throw native crash report over the SpiderMonkey callback reportError function in order to get some more details:

 void reportError(JSContext *cx, const char *message, JSErrorReport *report)
 {
   char _js_log_buf[MAX_LOG_LENGTH];
 
   snprintf(_js_log_buf, MAX_LOG_LENGTH, "%s:%u:%s\n",
    report->filename ? report->filename : "<no filename=\"filename\">",
    (unsigned int) report->lineno,
    message);

   cocos2d::log("ERROR: %s", _js_log_buf);
 }

I’m using Crashlytics tools, and I collected the crashes:

  1. Fatal Exception: java.lang.RuntimeException: :0:too much recursion

    at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesEnd(Unknown Source)
    at org.cocos2dx.lib.Cocos2dxRenderer.handleActionUp(Unknown Source)
    at org.cocos2dx.lib.Cocos2dxGLSurfaceView$9.run(Unknown Source)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1577)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1354)
    
  2. Fatal Exception: java.lang.RuntimeException: :0:too much recursion

    at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesBegin(Unknown Source)
    at org.cocos2dx.lib.Cocos2dxRenderer.handleActionDown(Unknown Source)
    at org.cocos2dx.lib.Cocos2dxGLSurfaceView$6.run(Unknown Source)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1577)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1354)
    
  3. Fatal Exception: java.lang.RuntimeException: :0:too much recursion

    at org.cocos2dx.lib.Cocos2dxRenderer.nativeTouchesMove(Unknown Source)
    at org.cocos2dx.lib.Cocos2dxRenderer.handleActionMove(Unknown Source)
    at org.cocos2dx.lib.Cocos2dxGLSurfaceView$7.run(Unknown Source)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1509)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1286)
    
  4. Fatal Exception: java.lang.RuntimeException: :0:too much recursion

    at org.cocos2dx.lib.Cocos2dxRenderer.nativeOnResume(Unknown Source)
    at org.cocos2dx.lib.Cocos2dxRenderer.handleOnResume(Unknown Source)
    at org.cocos2dx.lib.Cocos2dxGLSurfaceView$3.run(Unknown Source)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1463)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
    

I cannot reproduce this crash, sometimes when coming back from background I’m facing crashes, but it is hard to reproduce.
I’m sure no recursions at the JS side.

Searching some info at the web pointed that the issue might be related to SpiderMonkey calls from non-GL thread, however, I was reviewed all JNI calls and found nothing.
Any idea?