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 253742 - Infinite loop in indexer for RequireJS project
Summary: Infinite loop in indexer for RequireJS project
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: RequireJS (show other bugs)
Version: 8.1
Hardware: All All
: P1 normal (vote)
Assignee: Roman Svitanic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-24 13:48 UTC by Jaroslav Havlin
Modified: 2015-07-31 12:45 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Havlin 2015-07-24 13:48:36 UTC
Background scanning can be trapped in a loop in o.n.m.javascript2.requirejs.editor.model.ConfigInterceptor.

Result value of ts.moveNext() in while-loop on line 218 is not checked, so LexUtilities.findNextToken always returns the same value and the loop cannot break.

Maybe this can be caused by "requirejs.config({...})" used inside a module.
Comment 1 Martin Fousek 2015-07-27 06:19:06 UTC
Increasing priority, sorry. But I'm not able to work with such a project now.

I'm attaching longer stacktrace:
RepositoryUpdater.worker" #55 daemon prio=1 os_prio=0 tid=0x00007fadf8331800 nid=0xc7b runnable [0x00007fadda3ed000]
   java.lang.Thread.State: RUNNABLE
	at java.util.Arrays$ArrayList.indexOf(Arrays.java:3853)
	at java.util.Arrays$ArrayList.contains(Arrays.java:3861)
	at org.netbeans.modules.javascript2.editor.api.lexer.LexUtilities.findNextToken(LexUtilities.java:454)
	at org.netbeans.modules.javascript2.requirejs.editor.model.ConfigInterceptor.loadPackages(ConfigInterceptor.java:210)
	at org.netbeans.modules.javascript2.requirejs.editor.model.ConfigInterceptor.intercept(ConfigInterceptor.java:172)
	at org.netbeans.modules.javascript2.editor.model.Model.getModelVisitor(Model.java:195)
	- locked <0x00000000c97b5750> (a org.netbeans.modules.javascript2.editor.model.Model)
	at org.netbeans.modules.javascript2.editor.model.Model.getGlobalObject(Model.java:503)
	at org.netbeans.modules.javascript2.editor.index.JsIndexer.index(JsIndexer.java:104)
	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$3.run(Indexable.java:248)
Comment 2 Jaroslav Havlin 2015-07-27 07:50:51 UTC
An "invasive workaround" is this change in Module.js file(s):

- requirejs.config({
+ var rjs = requirejs;
+ rjs.config({
Comment 3 Roman Svitanic 2015-07-27 09:01:14 UTC
Changeset: 999971b8d58d
Author:    Roman Svitanic <rsvitanic@netbeans.org>
Date:      2015-07-27 11:03
Message:   #253742: Infinite loop in indexer for RequireJS project - fixed
Comment 4 Vladimir Riha 2015-07-27 18:31:19 UTC
Thank you, cannot reproduce. Please transplant to Beta branch. 


Product Version: NetBeans IDE Dev (Build web-main-2600-on-20150727)
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14
System: Linux version 3.16.0-30-generic running on amd64; UTF-8; en_US (nb)
Comment 5 Quality Engineering 2015-07-28 01:20:19 UTC
Integrated into 'main-silver', will be available in build *201507280002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/999971b8d58d
User: Roman Svitanic <rsvitanic@netbeans.org>
Log: #253742: Infinite loop in indexer for RequireJS project - fixed
Task #253742 - Infinite loop in indexer for RequireJS project
Comment 6 Roman Svitanic 2015-07-28 08:56:37 UTC
transplanted into release81_beta branch:
http://hg.netbeans.org/releases/rev/669c1ca6c0d9
Comment 7 Vladimir Riha 2015-07-31 12:45:44 UTC
Cannot reproduce in Beta

Product Version: NetBeans IDE 8.1 Beta (Build 201507302201)
Java: 1.8.0_51; Java HotSpot(TM) 64-Bit Server VM 25.51-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_51-b16
System: Linux version 3.16.0-30-generic running on amd64; UTF-8; en_US (nb)