Bug 196490 - Javascript parser errors indirectly refers to their parser result and snapshot which causes OOM during tasklist indexing
Javascript parser errors indirectly refers to their parser result and snapsho...
Status: RESOLVED FIXED
Product: javascript
Classification: Unclassified
Component: Editor
7.0
PC Mac OS X
: P2 (vote)
: 7.0
Assigned To: Marek Fukala
issues@javascript
: 70_HR_FIX, PERFORMANCE
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-09 13:14 UTC by Marek Fukala
Modified: 2011-03-18 08:37 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2011-03-09 13:14:48 UTC
The parser errors produced by the javascript parser refers to the AST Node where the error came from. However the node holds a reference to the AST and the whole JsParser result and the Snapshot.

This wouldn't be so big problem if there werent the TLIndexer (tasklist). During the files indexation it collects all the errors it gets from the given parser results. However it means that during the indexing of javascript files all the parser results, snapshots and other related objects are held. If there's more js files this inevitably lead to an OOM as it happened in the report below:

http://statistics.netbeans.org/exceptions/exception.do?id=490857
Comment 1 Marek Fukala 2011-03-10 15:15:08 UTC
Since there might always be a parser result producing Error instancies with some extensive objects map attached to the parameters field the error cannot be simply fixed at the JS side. 

The only proper way how to fix this problem securely is not to pass the org.netbeans.modules.csl.api.Error instancies directly to the ErrorsCache.setErrors() but use an artificial object which holds the minimum information required by showing the error in the tasklist. This introduces a smaller memory overhead since some of the error's fields needs to be cloned, but it is much better than holding some errors with megabytes of object attached to them.

fixed in web-main#c9421f66dbba

Honzo, can you please review the change so I can put it to 7.0? Thanks
Comment 2 Jan Lahoda 2011-03-10 16:28:22 UTC
The patch seems fine to me, thanks. Note that the idea is that TLIndexer's errors map should contain errors only from one file.
Comment 3 Marek Fukala 2011-03-10 18:58:31 UTC
(In reply to comment #2)
> The patch seems fine to me, thanks. Note that the idea is that TLIndexer's
> errors map should contain errors only from one file.

???

private static final Map<Indexable, Collection<SimpleError>> errors = new IdentityHashMap<Indexable, Collection<SimpleError>>();
Comment 4 Quality Engineering 2011-03-11 09:42:48 UTC
Integrated into 'main-golden', will be available in build *201103110400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c9421f66dbba
User: Marek Fukala <mfukala@netbeans.org>
Log: #196490 - Javascript parser errors indirectly refers to their parser result and snapshot which causes OOM during tasklist indexing
Comment 5 Marek Fukala 2011-03-18 08:37:00 UTC
fixed in 7.0 http://hg.netbeans.org/releases/rev/c9421f66dbba


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo