Titanium studio 1.7.0: debug breakpoints causing "too deep recursion" on android

You must Login before you can answer or comment on any questions.

Hello, while using the new TitaniumStudio debugger I'm been quite frustrated by the

msg:org.mozilla.javascript.EvaluatorException: Too deep recursion while parsing
error when placing breakpoints in my code and debugging it on the android simulator. It doesn't happen with iOS.

I even tried setting the stack size to ridiculously large values

<property name="ti.android.threadstacksize" type="int">2097152</property>
but didn't really help :/

any suggestion?

thx lucio

4 Answers

this thing is VERY annoying... Placing a breakpoint in whatever code that is not totally trivial will just break up everything ending up in that too-deep recursion error... What's the point of a debugger that breaks you code while trying to debug it? :/

Lucio

Please take note of this advice in the docs: Avoid deep nesting

Setting threadstacksize to very large values is likely to cause problems; 128K or lower is recommended.

Hope this helps

Hi paul, thx for aswering :)

I'm not really deep nesting: it's just a webView in a modal window opening upon click on an advertising banner. The app is tabbed base. This code use to work fine on 1.6.2 but now crashes the app on android (titanium 1.7.0) for some reason, no problems on iOS. I was trying to find the reason and placed 2 break points hoping the new debugger could help me figure out what's going on Here's the code:

(banner is an imageView displaying a PNG)
  banner.addEventListener('click', __bind(function(e) {
    var closeBtn, landingPageWin, webView;
    landingPageWin = Ti.UI.createWindow({
      backgroundColor: 'white',
      navBarHidden: false,
      tabBarHidden: true,
      orientationModes: [Ti.UI.PORTRAIT, Ti.UI.UPSIDE_PORTRAIT, Ti.UI.LANDSCAPE_LEFT, Ti.UI.LANDSCAPE_RIGHT]
    });
    if (bz.os !== 'android') {
      closeBtn = Ti.UI.createButton({
        title: "Chiudi"
      });
      closeBtn.addEventListener('click', function() {
        return landingPageWin.close();
      });
      landingPageWin.leftNavButton = closeBtn;
    } else {
      landingPageWin.addEventListener('android:back', function() {
        return landingPageWin.close();
      });
    }
    webView = Ti.UI.createWebView({
      url: e.source.clickURL,
      touchEnabled: true
    });
    landingPageWin.add(webView);  // break point 1
    landingPageWin.open({ // break point 2
      modal: true
    });
  }, this));
}
I'm aware of the stack size :) I was setting those insane values trying to get passed that "recursion" error, but it didin't help at all and I'm pretty much still stucked there

— answered 2 years ago by lucio lucio
answer permalink
3 Comments
  • Lucio

    I can investigate this, but would you first amend your code so that it will run? Thanks

    — commented 2 years ago by Paul Dowsett

  • mmm my code is actually running now. After testing it on real devices turned out to be my simulators acting up :/ I will check if even the break points issue is due to the simulator, but I'll have to wait until tomorrow to get my hand on another simulator. I'll keep you updated

    thx for help lucio

    — commented 2 years ago by lucio lucio

  • hi paul, I just finished a test-run on colleagues' emulators and it does crash on their machines as well. here's the stackTrace we're getting:

    W/dalvikvm(  482): threadid=14: thread exiting with uncaught exception (group=0x4001d800)
    E/TiUncaughtHandler(  482): (kroll$3) [61,20339] Sending event: exception on thread: kroll$3 msg:java.lang.NullPointerException; Titanium 1.7.0,2011/06/06 18:05,4155ee
    E/TiUncaughtHandler(  482): java.lang.NullPointerException
    E/TiUncaughtHandler(  482):     at ti.modules.titanium.debug.DebugServer.e(Unknown Source)
    E/TiUncaughtHandler(  482):     at ti.modules.titanium.debug.DebugServer.a(Unknown Source)
    E/TiUncaughtHandler(  482):     at ti.modules.titanium.debug.g.threadStarted(Unknown Source)
    E/TiUncaughtHandler(  482):     at org.appcelerator.titanium.kroll.KrollContext.initContext(KrollContext.java:178)
    E/TiUncaughtHandler(  482):     at org.appcelerator.titanium.kroll.KrollHandlerThread.onLooperPrepared(KrollHandlerThread.java:74)
    E/TiUncaughtHandler(  482):     at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:85)
    E/AndroidRuntime(  482): FATAL EXCEPTION: kroll$3
    E/AndroidRuntime(  482): java.lang.NullPointerException
    E/AndroidRuntime(  482):    at ti.modules.titanium.debug.DebugServer.e(Unknown Source)
    E/AndroidRuntime(  482):    at ti.modules.titanium.debug.DebugServer.a(Unknown Source)
    E/AndroidRuntime(  482):    at ti.modules.titanium.debug.g.threadStarted(Unknown Source)
    E/AndroidRuntime(  482):    at org.appcelerator.titanium.kroll.KrollContext.initContext(KrollContext.java:178)
    E/AndroidRuntime(  482):    at org.appcelerator.titanium.kroll.KrollHandlerThread.onLooperPrepared(KrollHandlerThread.java:74)
    E/AndroidRuntime(  482):    at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:85)
    W/ActivityManager(   60):   Force finishing activity it.banzai.liquida.liquida.test/ti.modules.titanium.ui.TiTabActivity
    D/TiHttpClient(  482): (TiHttpClient-9) [165,20504] Setting ready state to 2
    D/TiHttpClient(  482): (TiHttpClient-9) [2,20506] Setting ready state to 3
    D/TiHttpClient(  482): (TiHttpClient-9) [19,20525] Setting ready state to 4
    W/iPhone  (  482): (kroll$1: app://app.js) [130,20655] UI.iPhone.TableViewCellSelectionStyle.NONE property isn't supported on Android
    W/iPhone  (  482): (kroll$1: app://app.js) [86,20741] UI.iPhone.TableViewCellSelectionStyle.NONE property isn't supported on Android
    W/ActivityManager(   60): Activity pause timeout for HistoryRecord{451a9b20 it.banzai.liquida.liquida.test/ti.modules.titanium.ui.TiTabActivity}
    I/Process (  482): Sending signal. PID: 482 SIG: 9
    I/ActivityManager(   60): Process it.banzai.liquida.liquida.test (pid 482) has died.
    I/WindowManager(   60): WIN DEATH: Window{4509f1b0 it.banzai.liquida.liquida.test/it.banzai.liquida.liquida.test.LiquidaActivity paused=false}
    I/WindowManager(   60): WIN DEATH: Window{450bf0d0 it.banzai.liquida.liquida.test/ti.modules.titanium.ui.TiTabActivity paused=false}
    I/UsageStats(   60): Unexpected resume of com.android.launcher while already resumed in it.banzai.liquida.liquida.test
    W/InputManagerService(   60): Got RemoteException sending setActive(false) notification to pid 482 uid 10040
    cheers lucio

    — commented 2 years ago by lucio lucio

Is it possible that you simply have a bug in that the closeBtn has not been created on 'android'?

if (bz.os !== 'android') {
      closeBtn = Ti.UI.createButton({
        title: "Chiudi"
      });

— answered 2 years ago by James Pereira
answer permalink
4 Comments
  • mmm nope, the close button is just for iOS, android should react on the android:back event. And it works fine on 1.6.2

    — commented 2 years ago by lucio lucio

  • Guess I should have asked...are you sure that bz.os has the correct value :(

    Also, note the docs say... It is recommended that you only have one handler per heavyweight window (Android Only)... is this a possibility...

    — commented 2 years ago by James Pereira

  • bz.os is just a macro for Ti.Platform.osname, and yes it has a value :) Also the only handler for the modal window is the android:back one.

    Thx for your help :)

    It turned out to be my android simulator acting up -_- (still no idea on what's going on there) Testing the app on real devices shows everything working fine (compiling with 1.7.0 as well)

    Anyway the point of this post wasn't my (stupid) problem, it was more about the impossibility to use the debugger due to the recursion error which, one the other hand, seems to be caused by what is been "added" to the code upon breakpoint (possibly JSON.stringify()s to inspect the objects' content?)

    — commented 2 years ago by lucio lucio

  • Show 1 more comment

Your Answer

Think you can help? Login to answer this question!