[TIMOB-1805] Android: Too deep recursion
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2013-08-01T00:11:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.5.0 |
Components | Android |
Labels | android, defect, recursion, rhino, rplist, stackoverflowerror |
Reporter | Marshall Culpepper |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T03:02:52.000+0000 |
Updated | 2017-03-20T17:53:34.000+0000 |
Description
Some apps will cause Rhino / Dalvik to reach a StackOverflowError and show an error message "Too deep recursion when parsing". We need to either increase the stack size of the Thread that parses the Javascript, or pre-compile the AST so the parsing doesn't happen on device (the latter might be good for speed anyway)
Attachments
File | Date | Size |
---|---|---|
module_media.zip | 2012-01-20T11:55:20.000+0000 | 4873819 |
module_media log.txt | 2012-01-20T11:55:20.000+0000 | 19193 |
sample_cloud_log.txt | 2012-04-26T15:19:15.000+0000 | 13383 |
sample_cloud.zip | 2012-04-26T15:19:15.000+0000 | 3197608 |
(from [ef98bfab872f7a5b08398a809da37b5ffe67a550]) use a 16K stack for Javascript parsing, this seems to give more room so some apps don't spit out the "Too deep recursion" error. copied the android HandlerThread class in so we could expose the stack size constructor of Thread [#1805] http://github.com/appcelerator/titanium_mobile/commit/ef98bfab872f7a5b08398a809da37b5ffe67a550"> http://github.com/appcelerator/titanium_mobile/commit/ef98bfab872f7...
(from [99989c74f5b83ad5fc6c45601d21e6ada78e16e1]) 16K, not 16M (good eye Bill) [#1805] http://github.com/appcelerator/titanium_mobile/commit/99989c74f5b83ad5fc6c45601d21e6ada78e16e1"> http://github.com/appcelerator/titanium_mobile/commit/99989c74f5b83...
FYI: I ran into this issue after I minified my JS using "google closure". I also merged all "library" files into one file before building a release version to reduce stat calls. The result was a file larger than 40k. Dont know whether the file size has something to do with the stack size.
(from [54629899a5631d2d2e1ef9ca4025c5831f640d1a]) initial implementation of Rhino JS->bytecode compiler for production apps, dramatically decreasing startup time and runtime code execution in general. this falls back on dynamic/unoptimized evaluation when a compiled script isn't found, and each file is compiled separately to avoid the arg size limit in windows. added a "ti.android.threadstacksize" property that allows each app to control the stack size allocated for each JS thread (by default it's 16K, but this may not be big enough for some apps) [#1109] [#1805] http://github.com/appcelerator/titanium_mobile/commit/54629899a5631d2d2e1ef9ca4025c5831f640d1a"> http://github.com/appcelerator/titanium_mobile/commit/54629899a5631...
Hi Marshall,
how can someone determine the best/correct/needed threadstacksize?
Best regards
@Jick
Try the new default stack size, and if you're still seeing the "Too deep recursion" error, you might need to try specifying something larger (I'd recommend increasing by factors of 2)
(from [d8ba51d99dd0a067968102ad63b628aad4d8fc71]) fixed a source code generation bug when a tiapp.xml property had an empty / bad value, turned on deploy type and a new ti.android.compilejs property to control when/if JS gets compiled for an application [#1805] http://github.com/appcelerator/titanium_mobile/commit/d8ba51d99dd0a067968102ad63b628aad4d8fc71"> http://github.com/appcelerator/titanium_mobile/commit/d8ba51d99dd0a...
regression tested on 1.5.0 (11/22/10 20:42 19a59fd) Android sim 2.1,
function recurse(count) {
};//end recurse
recurse(1000000);
resolved as per Matt
Reopening Issue. Bug Still Valid. Attached new fail-case test project: module_media.zip Attached runtime error log: module_media log.txt Error caused by: module_media/Resources/acceptance.js > tpl.at.timob_5900 = function (_window) {...}) (lines 248-332) There is a syntax/semantic error in this function involving two extra curly braces (lines 248 and 328). Removing them will allow the app to run. Note: Studio does not recognize the error and there are no recursion errors in iOS/V8 (these platforms appear to behave correctly). SDK: 1.9.0.v20120119134634, 1.8.0.1.v20120119133134 Android: Rhino Studio: 1.0.8.201201190907 OS: Lion Devices Tested: Galaxy Nexus 4.0.2, Droid3 2.3.4 Steps to Reproduce: 1. Run project using Rhino. Expected Result: App should run. Actual Result: Runtime Error.
Also getting too deep recursion error when running the cloud sample app. Bug appears on: SDK build: 2.0.1.GA2 Runtime: Rhino Titanium Studio, build: 2.0.2.201204252015 Device: Droid 3 2.3.4 Steps to reproduce: 1. Launch cloud_app in rhino
Won't fix because Rhino is no longer supported.
Closing ticket as Rhino is no longer supported.