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 218708

Summary: Accessing file system in EDT: registerJsClassPathIfNeeded
Product: javascript Reporter: Egor Ushakov <gorrus>
Component: EditorAssignee: Martin Fousek <marfous>
Status: RESOLVED FIXED    
Severity: normal Keywords: PERFORMANCE
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 218138    

Description Egor Ushakov 2012-09-20 15:50:22 UTC
The work inside registerJsClassPathIfNeeded is performed in EDT, it involves InstalledFileLocator which does many file system requests which may be rather slow, during that work EDT is blocked and IDE may freeze.
Is it possible to use another thread not EDT?
Comment 1 Martin Fousek 2012-09-20 17:37:13 UTC
Are you sure that you have it called from AWT EDT? At the first glance it didn't looked to me so from the stackTrace, so I also tried directly isEDT() and I didn't have it called from EDT any time.

Do you have steps how to reproduce that? How to get this called from EDT?

Thanks...
Comment 2 Egor Ushakov 2012-09-20 18:52:55 UTC
well, I'm not talking about registerJsClassPathIfNeeded itself, but inside it all useful work is done inside SwingUtilities.invokeLater which is definitely EDT
Comment 3 Martin Fousek 2012-09-21 06:52:54 UTC
(In reply to comment #2)
> well, I'm not talking about registerJsClassPathIfNeeded itself, but inside it
> all useful work is done inside SwingUtilities.invokeLater which is definitely
> EDT

Sorry Egor, as I wrote I took a look on that just quickly before so I also overlook that the pain for you is what is called inside the method and not where is called that method.

You know, it's not easy to find proper place to register JS classpath since JS doesn't need any specific project type, one time it's just needed. ;) I moved the registration to the lexer getter of the language - it should establish call the first registration when really required (so it isn't called for C++ at all for now). Let's wait how it will behave to all users which needs the JS. It looked to me well also in languages which can embed it for now so I hope we will be able to stay with that solution.

Fixed in web-main #536fe324d2c0.
Comment 4 Egor Ushakov 2012-09-21 09:23:42 UTC
Thanks! now it really does not affect c++.
But I believe the bug is still there - fs is still accessed from EDT. Is it really a requirement to use SwingUtilities.invokeLater here? Can any other thread do the job?
Comment 5 Quality Engineering 2012-09-22 02:15:36 UTC
Integrated into 'main-golden', will be available in build *201209220001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/536fe324d2c0
User: Martin Fousek <marfous@netbeans.org>
Log: #218708 - Accessing file system in EDT: registerJsClassPathIfNeeded
Comment 6 Martin Fousek 2012-09-25 12:47:44 UTC
(In reply to comment #4)
> But I believe the bug is still there - fs is still accessed from EDT. Is it
> really a requirement to use SwingUtilities.invokeLater here? Can any other
> thread do the job?

It broke about 100+ JS tests for first time so I didn't take it enough of care since it looked to me resolved for C++ troubles... I spent a more time on that now and it looks to me that the JavaScript tests had above all wrongly registered CP, so I correct them and everything looks to be working well - also when the CP registration happens on the background in the RP. Manual testing in IDE with empty userdir worked properly to me as well.

Fixed in web-main #828b172500a3.
Comment 7 Milutin Kristofic 2012-09-26 11:08:52 UTC
Mess in bug id
http://hg.netbeans.org/main-golden/rev/828b172500a3

gets in to gold in bug #218706
Comment 8 Martin Fousek 2012-09-26 12:04:50 UTC
Sorry for confusion, the fix should be already in trunk but I placed wrong bug ID into the commit message.