Bug 431946 - "Maximum call stack size exceeded" exception opening textView.js
Summary: "Maximum call stack size exceeded" exception opening textView.js
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: 5.0   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 6.0 M1   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-03 13:29 EDT by Michael Rennie CLA
Modified: 2014-04-15 15:48 EDT (History)
3 users (show)

See Also:


Attachments
proposed fix (4.66 KB, patch)
2014-04-10 12:05 EDT, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2014-04-03 13:29:30 EDT
Navigated to textView.js and got the following exception:

Error retrieving content assist proposals contentAssist.js:286
Error: Maximum call stack size exceeded
    at Object.internalRegistry.handleServiceError (http://target.orion.eclipse.org:8080/orion/pluginregistry.js:1029:29)
    at Object._messageHandler [as handler] (http://target.orion.eclipse.org:8080/orion/pluginregistry.js:389:55)
    at http://target.orion.eclipse.org:8080/orion/pluginregistry.js:1075:33
    at Array.some (native)
    at _messageHandler (http://target.orion.eclipse.org:8080/orion/pluginregistry.js:1064:23) 

nothing else logged, did nothing other than open the file.
Comment 1 Michael Rennie CLA 2014-04-09 13:16:24 EDT
To make things even more confusing I was typing in a JS file with the following contents:

var foo = { };
(var foo.
When I type the '.' auto-assist works as expected, but If I manually invoke assist (Ctrl+Space) I get the following:

Error retrieving content assist proposals contentAssist.js:286
Error: Maximum call stack size exceeded
    at Object.PluginRegistry.internalRegistry.handleServiceError (http://target.orion.eclipse.org:8080/orion/pluginregistry.js:1029:29)
    at Object._messageHandler [as handler] (http://target.orion.eclipse.org:8080/orion/pluginregistry.js:389:55)
    at http://target.orion.eclipse.org:8080/orion/pluginregistry.js:1075:33
    at Array.some (native)
    at _messageHandler (http://target.orion.eclipse.org:8080/orion/pluginregistry.js:1064:23) 

This is happening on Mac OS using Chrome 33.0.1750.152
Comment 2 Michael Rennie CLA 2014-04-09 15:36:24 EDT
Finally found the problem. The new version of eslint has some code in it that is modifying our shared AST by adding a 'parent' node that points to the parent AST node (surprise). Now, during the inference pass when our visitor is collecting children, it ends up adding this 'parent' node and revisiting it again and again and again, until the exception.

This does not happen in the auto-assist case because auto-assist just happens to run before eslint validates (so no 'parent' nodes in the AST). 

The fix is to add another check in esprimaVisitor for the 'parent' node and ignore it during the child-collection phase. Unless we want to start customizing eslint (which I don't)
Comment 4 Michael Rennie CLA 2014-04-09 16:23:56 EDT
I just managed to reproduce this again running one of the cyclic tests:

[failed] test cycle 3  (20.959s)
  AssertionError: [object Object]
 Stack Trace:
AssertionError: [object Object]
    at Function.require.register.module.exports.assert.fail (http://tests.orion.eclipse.org:8080/chai/chai.js:2272:11)
    at http://tests.orion.eclipse.org:8080/js-tests/javascript/contentAssistTests.js:165:11
    at settleDeferred (http://tests.orion.eclipse.org:8080/orion/Deferred.js:71:28)
    at notify (http://tests.orion.eclipse.org:8080/orion/Deferred.js:145:18)
    at MutationObserver.run (http://tests.orion.eclipse.org:8080/orion/Deferred.js:29:13)
Comment 5 Michael Rennie CLA 2014-04-10 12:05:03 EDT
Created attachment 241847 [details]
proposed fix

Here is an updated fix. All the unit tests pass and smoke testings did not cause any exceptions.

This patch removes inferring the token stream (which adds no value) and removes the sort pass (since the AST is already in range-order).
Comment 6 Michael Rennie CLA 2014-04-10 12:24:29 EDT
I pushed the updated fix to master; http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=cefd299f20ac933d64cd4b9c59c5625064a8de18

I'l leave the bug open until we have some more testing to confirm all is well
Comment 7 Michael Rennie CLA 2014-04-15 15:48:28 EDT
(In reply to Michael Rennie from comment #6)
> I pushed the updated fix to master;
> http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/
> ?id=cefd299f20ac933d64cd4b9c59c5625064a8de18
> 
> I'l leave the bug open until we have some more testing to confirm all is well

Verified the problem is fixed in the latest deployed build on orion.eclipse.org.