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 165915 - JsLanguage and JsParser loaded on start
Summary: JsLanguage and JsParser loaded on start
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Marek Fukala
URL: http://wiki.netbeans.org/FitnessViaWh...
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2009-05-25 08:29 UTC by Jaroslav Tulach
Modified: 2010-01-13 12:28 UTC (History)
7 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 Tulach 2009-05-25 08:29:43 UTC
Since May 15, 2009 the Netigso build[1] randomly fails in 
org.netbeans.test.editor.GeneralSanityTest.testBlacklistedClassesHandler
due to processing of some Java script files. This is the suspicion part from the whole log[2]:

Paths changed:
 event=PATHS_ADDED pathKind=LIBRARY pathType=JavascriptBootClassPath affected paths:
  "/home/hudson/.hudson/jobs/netigso/workspace/nbbuild/netbeans/ide11/jsstubs/allstubs.zip"
--
====
RepositoryUpdater caller [id=0] :
java.lang.Thread.getStackTrace(Thread.java:1426)
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.recordCaller(RepositoryUpdater.java:879)
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.scheduleWork(RepositoryUpdater.java:759)
org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.pathsChanged(RepositoryUpdater.java:363)
org.netbeans.modules.parsing.impl.indexing.PathRegistry.fire(PathRegistry.java:491)
org.netbeans.modules.parsing.impl.indexing.PathRegistry.run(PathRegistry.java:359)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:577)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1030)
FINE [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Scheduling InitialRootsWork@14ec310
[followUpJob=false, checkEditor=false, useInitialState=true
BlacklistedClassesHandler blacklist violator: org.netbeans.modules.javascript.editing.JsLanguage
BlacklistedClassesHandler blacklist violator: org.netbeans.modules.javascript.editing.JsParser
BlacklistedClassesHandler blacklist violator: org.netbeans.modules.javascript.editing.JsLanguage
FINE [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: LibraryIds: [JavascriptBootClassPath]
FINE [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: BinaryLibraryIds: [classpath/boot, 
classpath/compile]

No need to fix in 6.7, but in general I think the initialization of any language providers shall be prevented until 
they are really needed.


[1] http://hudson.apidesign.org/hudson/job/netigso/
[2] 
http://hudson.apidesign.org/hudson/job/netigso/155/testReport/org.netbeans.test.editor/GeneralSanityTest/testBlacklistedClassesHandler/
Comment 1 Jaroslav Tulach 2009-05-25 11:29:09 UTC
Imho, this is problem of javascript.editor Installer (although I need others to verify that opinion):

    @Override
    public void restored() {
        WindowManager.getDefault().invokeWhenUIReady(new Runnable() {
            public void run() {
                GlobalPathRegistry.getDefault().register(JsClassPathProvider.BOOT_CP, new ClassPath[] { 
JsClassPathProvider.getBootClassPath() });
            }
        });
    }

To reproduce locally get revision ae393e723aa0 or newer, apply following patch and run its test:

diff -r ae393e723aa0 ide.kit/test/qa-functional/src/org/netbeans/test/ide/GeneralSanityTest.java
--- a/ide.kit/test/qa-functional/src/org/netbeans/test/ide/GeneralSanityTest.java       Mon May 25 12:20:32 2009 +0200
+++ b/ide.kit/test/qa-functional/src/org/netbeans/test/ide/GeneralSanityTest.java       Mon May 25 12:23:33 2009 +0200
@@ -81,7 +81,7 @@
             ).gui(true).clusters(".*").enableModules(".*").
             honorAutoloadEager(true).
             addTest(
-//                "testWaitForUIReady",
+                "testWaitForUIReady",
                 "testBlacklistedClassesHandler",
                 "testOrgOpenideOptionsIsDisabledAutoload",
                 "testOrgNetBeansModulesLanguagesIsDisabledAutoload",
Comment 2 Vitezslav Stejskal 2009-05-25 12:46:22 UTC
I think Jarda's analysis is correct. Javascript needs to register its classpath with jsstubs.zip, but it does not have a
project to do so. That's why it's done in module install. Maybe we could move it somewhere else (eg. to JsLanguage)...
Comment 3 Petr Jiricka 2009-05-27 14:10:06 UTC
Actually, according to Vita, this problem also causes another bad effect, which is more user-visible: right after
startup, there is a "Scanning projects..." progress bar going on for several seconds (which parses JavaScript stubs),
and this looks awkward and creates a bad user experience ("why is the IDE scanning projects when I have no projects open?").

So I reset the target milestone, please reevaluate whether this issue could/should be fixed for 6.7. Thanks.

Also cc'ing Ludo who brought up this issue yesterday.
Comment 4 Marek Fukala 2009-05-29 10:39:48 UTC
fixed in web-main#fedf7afc9fc4 by moving the classpath initialization from the module installer to the JsLanguage
constructor.

The JsLanguage instance is created when a project with js file is opened or without project (in favourites) when a
javascript file is selected in the explorer. BTW the user may think "why the IDE scans projects if I just opened a file
from the explorer?" ;-) But of course such scenario is far less often than just running a fresh ide and getting the scan
after that.

The CP initialization is done lazily so if a hypothetic code requires the classpath registered just after the language
creation it simply won't get it.

I have fixed the code in trunk which I consider fine with a small risk of potential regressions. Since I am not that
familiar with the javascript code to be sure the change is safe, I won't recommend the fix to be put in 6.7. The added
value of the fix doesn't compensate the risk at all IMHO. If Vita or someone else "signs" that the change is safe, then
go ahead and do what you think is right to do ;-)



Comment 5 Jaroslav Tulach 2009-05-29 16:48:45 UTC
Please also enable the testWaitForUIReady mentioned above to verify that your fix prevents loading of these classes on 
start forever. 
Comment 6 Petr Jiricka 2009-05-29 18:45:55 UTC
The original problem is fixed, so reopening is not appropriate. If an additional test is requested, then a separate task
should be filed.
Comment 7 Quality Engineering 2009-05-29 19:51:41 UTC
Integrated into 'main-golden', will be available in build *200905291401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/fedf7afc9fc4
User: Marek Fukala <mfukala@netbeans.org>
Log: #165915 - JsLanguage and JsParser loaded on start
Comment 8 Marek Fukala 2009-05-30 08:21:51 UTC
the test is reenabled in web-main#53bb02208479 and passes.
Comment 9 Jaroslav Tulach 2009-05-30 09:17:15 UTC
I am sorry, but the way to reproduce original problem is to run the test. Until the test is known to pass, the issue 
is not fixed imho and definitely cannot be verified.
Comment 10 Jaroslav Tulach 2009-05-30 09:21:16 UTC
Perfect, thanks for the test.
Comment 11 Jaroslav Tulach 2009-05-30 21:48:00 UTC
Build without your changes failed:
http://hudson.apidesign.org/hudson/job/netigso/168/
As soon as I merged your fix, the test passed:
http://hudson.apidesign.org/hudson/job/netigso/169/

Thanks.
Comment 12 Marian Mirilovic 2009-06-09 11:32:05 UTC
we'll try to test it today, just to confirm that there is no regression ... I would vote for fixing this one into
release67 (this is the most visible and the most senseless scan during the IDE session).
Comment 13 Marian Mirilovic 2009-06-10 10:04:13 UTC
mschovanek, 
have you had a chance to test it ? Could you please verify this fix in trunk ? Thanks in advance.
Comment 14 Martin Schovanek 2009-06-10 10:15:30 UTC
Verified in trunk build by QE, please transplant into release67.
Comment 15 Erno Mononen 2009-06-10 12:30:41 UTC
Transplanted to release67: http://hg.netbeans.org/release67/rev/d85b6b2e3517.
Comment 16 Jindrich Sedek 2009-06-11 11:31:24 UTC
v.
Comment 17 Quality Engineering 2010-01-13 12:28:34 UTC
Integrated into 'main-golden', will be available in build *201001131418* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b9bc77139a60
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: After fix of #165915 the JsParse* classes shall no longer be loaded