This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 246598 - StackOverflowError at org.netbeans.modules.javascript2.editor.model.impl.JsObjectReference.resolveTypes
Summary: StackOverflowError at org.netbeans.modules.javascript2.editor.model.impl.JsOb...
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: All All
: P2 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
: 246704 246728 246884 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-08-21 07:08 UTC by Tomas Mysik
Modified: 2014-09-18 14:57 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 211349


Attachments
stacktrace (92.05 KB, text/plain)
2014-08-21 07:08 UTC, Tomas Mysik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Mysik 2014-08-21 07:08:14 UTC
Build: NetBeans IDE Dev (Build 20140821-edc32f0027c2)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.65-b04, Java(TM) SE Runtime Environment, 1.7.0_67-b01
OS: Linux

User Comments:
tmysik: creating html5 from existing sources -> scanning...




Stacktrace: 
java.lang.StackOverflowError
   at org.netbeans.modules.javascript2.editor.model.impl.JsObjectReference.resolveTypes(JsObjectReference.java:135)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:495)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:504)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:504)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:504)
   at org.netbeans.modules.javascript2.editor.model.Model.resolveLocalTypes(Model.java:504)
Comment 1 Tomas Mysik 2014-08-21 07:08:16 UTC
Created attachment 148806 [details]
stacktrace
Comment 2 Tomas Mysik 2014-08-21 07:17:42 UTC
Exact steps:
- download ZIP of this project [1]
- create a new HTML5 project for it (set SiteRoot for Project Directory!)
- invoke NPM Install (can end with errors)
- invoke Bower install

-> exception occurs during scanning

Thanks.
[1] https://github.com/JakubMrozek/Zdrojak

Product Version: NetBeans IDE Dev (Build 20140821-edc32f0027c2)
Java: 1.7.0_67; Java HotSpot(TM) 64-Bit Server VM 24.65-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_67-b01
System: Linux version 3.13.0-34-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 3 Petr Pisl 2014-08-26 13:47:16 UTC
*** Bug 246704 has been marked as a duplicate of this bug. ***
Comment 4 Petr Pisl 2014-08-27 15:25:40 UTC
Fixed in web-main. 
Changeset: d2cad080cf2c

The fix is not fully correct. The problem is cased basically with this construction:

prom.method = function prom(){ };

When the model is created from AST, then the function prom is created as the first one like normally in runtime. But then when is evaluated prom.method access node, then the method property is added to the function prom. As the last step due to the assignment is the method property a function reference to the prom function object. And this introduces cycle reference.

Normally in the runtime is the function prom replaced with the anonym function and basically its name is ignored.

Unfortunately we are not able now recognized this "pattern" until we resolved the assignment. The fix basically just add the property method as normal property, not reference to the prom function. But it's basically wrong.

The right solution would be change the prom function to the anonymous function, create new prom object in the model and add the method property as reference to the anonymous function. But there is one more problem, that the prom function has already property / methods that was used before. And because we are not able to recognized this at the beginning the right solution would probably require go to the through AST two times. I'm not sure, whether it worth for it.
Comment 5 Tomas Mysik 2014-08-28 05:28:02 UTC
Petře, haven't you forgot to push the change? Thanks.
Comment 6 Petr Pisl 2014-08-28 08:53:40 UTC
You are right:). Now it's in the web-main.
Comment 7 Tomas Mysik 2014-08-28 10:39:36 UTC
Verified, thanks.

Product Version: NetBeans IDE Dev (Build 20140828-13009c9548ec)
Java: 1.7.0_67; Java HotSpot(TM) 64-Bit Server VM 24.65-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_67-b01
System: Linux version 3.13.0-34-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 8 Quality Engineering 2014-08-29 02:42:20 UTC
Integrated into 'main-silver', will be available in build *201408290001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d2cad080cf2c
User: Petr Pisl <ppisl@netbeans.org>
Log: #246598 - StackOverflowError at org.netbeans.modules.javascript2.editor.model.impl.JsObjectReference.resolveTypes
Comment 9 Petr Pisl 2014-08-29 07:06:34 UTC
*** Bug 246728 has been marked as a duplicate of this bug. ***
Comment 10 Petr Pisl 2014-09-05 08:37:06 UTC
*** Bug 246884 has been marked as a duplicate of this bug. ***
Comment 11 Petr Pisl 2014-09-16 13:25:20 UTC
Transplanted to releases/release801 branch.
Comment 12 Vladimir Riha 2014-09-18 14:57:58 UTC
This issue is no longer reproducible, so marking as verified in patch. But issue 247274 happens when one is following steps from comment #2.


Product Version: NetBeans IDE 8.0.1 (Build 201409180010)
Java: 1.7.0_67; Java HotSpot(TM) Client VM 24.65-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_67-b01
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)