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 205972

Summary: LowPerformance took 6145 ms.
Product: javaee Reporter: dwuysan <dwuysan>
Component: EJBAssignee: Martin Fousek <marfous>
Status: RESOLVED FIXED    
Severity: normal CC: ads, cdicarlo, hantsy, juger89, lallafa, pjiricka
Priority: P3 Keywords: PERFORMANCE
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 183465
Attachments: nps snapshot

Description dwuysan 2011-12-06 05:21:09 UTC
This bug was originally marked as duplicate of bug 172931, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 7.1 RC2 (Build 201111302200)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.0-b03, Java(TM) SE Runtime Environment, 1.7.0_04-ea-b01
OS: Linux

User Comments:
dwuysan: Right-Click on Class name. Generally, all right-click is very slow in Netbeans.



Maximum slowness yet reported was 6145 ms, average is 6145
Comment 1 dwuysan 2011-12-06 05:21:14 UTC
Created attachment 113848 [details]
nps snapshot
Comment 2 lallafa 2012-01-19 14:23:18 UTC
i get this "slowness detected" when switching from jsf source file to a java source file (in editor usinf ctrl-tab) in a maven web project. in NB 7.0 it was related to #200997.
Comment 3 Petr Jiricka 2012-04-13 09:54:32 UTC
Looks like a duplicate of bug 200997 - Martin please confirm.

*** This bug has been marked as a duplicate of bug 200997 ***
Comment 4 Martin Janicek 2012-04-18 07:53:37 UTC
I'm reopening this one (see discussion in issue 200997 for some background)..
Comment 5 lallafa 2012-04-18 12:38:12 UTC
I dont't know how if this is the correct issue but issue 200997 has been closed with reference to this one.

It's true, that I don't get "slowness detected" messages with NB 7.1 related to this. 

But sometimes switching from a JSP file to it's java bean file is still very slow (10 to 20 seconds, or more?).

I have a maven web project with 80 JSPs.

I just tried it again. It took more than 15 seconds. I clear the netbeans.log befor switching from JSP to java file. This is the content after the switch:

INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: class org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper ignored cancel for 14.141 ms.
java.io.IOException
	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:444)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:403)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider.setServletClasses(WebReplaceTokenProvider.java:375)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider.access$000(WebReplaceTokenProvider.java:90)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$1.run(WebReplaceTokenProvider.java:309)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1411)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1991)
Caused by: java.io.IOException: Setting attribute not allowed for JarFileSystem [D:\Dokumente und Einstellungen\clav02\.m2\repository\javax\faces\jsf-api\1.2_15\jsf-api-1.2_15-sources.jar!javax/faces/webapp/FacesServlet.java <- org.netbeans.modules.web.IsServletFile=true]
	at org.openide.filesystems.JarFileSystem.writeAttribute(JarFileSystem.java:671)
	at org.openide.filesystems.JarFileSystem$Impl.writeAttribute(JarFileSystem.java:1222)
	at org.openide.filesystems.AbstractFileObject.setAttribute(AbstractFileObject.java:357)
	at org.openide.filesystems.AbstractFileObject.setAttribute(AbstractFileObject.java:340)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$3.run(WebReplaceTokenProvider.java:398)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$3.run(WebReplaceTokenProvider.java:375)
	at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:482)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:643)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:154)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:138)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:211)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:208)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:168)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:356)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:71)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:208)
	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:106)
	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:432)
	... 6 more
java.io.IOException
	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:444)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:403)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider.setServletClasses(WebReplaceTokenProvider.java:375)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider.access$000(WebReplaceTokenProvider.java:90)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$1.run(WebReplaceTokenProvider.java:309)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1411)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1991)
Caused by: java.io.IOException: Setting attribute not allowed for JarFileSystem [D:\Dokumente und Einstellungen\clav02\.m2\repository\javax\faces\jsf-api\1.2_15\jsf-api-1.2_15-sources.jar!javax/faces/webapp/FacesServlet.java <- org.netbeans.modules.web.IsServletFile=true]
	at org.openide.filesystems.JarFileSystem.writeAttribute(JarFileSystem.java:671)
	at org.openide.filesystems.JarFileSystem$Impl.writeAttribute(JarFileSystem.java:1222)
	at org.openide.filesystems.AbstractFileObject.setAttribute(AbstractFileObject.java:357)
	at org.openide.filesystems.AbstractFileObject.setAttribute(AbstractFileObject.java:340)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$3.run(WebReplaceTokenProvider.java:398)
	at org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider$3.run(WebReplaceTokenProvider.java:375)
	at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:482)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:643)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:154)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:138)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:211)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:208)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:168)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:356)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:71)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:208)
	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:106)
	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:432)
	... 6 more
WARNING [org.netbeans.JarClassLoader]: Opening C:\Programme\NetBeans 7.1\ide\modules\org-netbeans-modules-utilities.jar took 593 ms
Comment 6 lallafa 2012-04-18 13:10:08 UTC
I just created another slowness report (http://statistics.netbeans.org/analytics/exception.do?id=574311) that is now assigned to issue 200997.
Comment 7 Martin Janicek 2012-04-18 14:40:14 UTC
Thanks for pointing this out. The last slowness report you just added looks like a different issue and from the snapshot it's related to JSF editor (expression language) --> reassigning to Marek for evaluation.
Comment 8 Martin Janicek 2012-04-18 15:02:21 UTC
As Petr suggested I've created separate issue 211400 related to your snapshot lallafa. (so reassigning this one back to me)
Comment 9 Martin Janicek 2012-04-20 12:58:59 UTC
Lallafa the problem you reported two days ago should be fixed now (see issue 211400 for more datails). Would be great if you could confirm that using latest builds.
Comment 10 lallafa 2012-04-22 10:37:30 UTC
I tried NB 201204210400 (fresh install, no import of old settings). But that build seems to be completely broken. No syntax highlighting, auto complete what so ever in java and jsp files.

I might try again after bug 208690 is resolved ...
Comment 11 Martin Janicek 2012-06-13 11:13:45 UTC
Denis, could you please help me with this one? The problem lies in the WebReplaceTokenProvider class (specifically in the part checking if the selected file is a servlet). You were actually the one fixing the original performance problem where the check was too slow when scanning were already in progress (issue 172931).

That works just fine, but now there is a problem with SourceUtils.getFile call in the setServletClasses() method (it looks that it's quite expensive but not sure how should I solve that). Any ideas are welcome! Thanks
Comment 12 Denis Anisimov 2012-06-15 06:50:23 UTC
(In reply to comment #11)
> Denis, could you please help me with this one? The problem lies in the
> WebReplaceTokenProvider class (specifically in the part checking if the
> selected file is a servlet). You were actually the one fixing the original
> performance problem where the check was too slow when scanning were already in
> progress (issue 172931).
> 
> That works just fine, but now there is a problem with SourceUtils.getFile call
> in the setServletClasses() method (it looks that it's quite expensive but not
> sure how should I solve that). Any ideas are welcome! Thanks

It's not really a problem with SourceUtils.getFile call.
This call is done in the separate thread org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider ( it's thread name ).
The latter thread calls setServletClasses method and then SourceUtils.getFile 
inside JavaSource lock.
AWT thread tries to invoke model method which also need to acquire lock 
inside JavaSource . As result it needs to wait until setServletClasses  method
finished.
It means that ANY lock on JavaSource ( in any other place not just inside 
org.netbeans.modules.maven.j2ee.web.WebReplaceTokenProvider ) will block 
the isServletFile() method.
So it seems any such action 
( which has a JavaSource call inside its "isEnabled()")  shouldn't use 
any Java infrastructure based model ( JavaSource directly or 
via MetaModel impl ) at all.
I think method should be rewritten to avoid such calls.
Servlet should be detected f.e. ONLY if it has appropriate attribute 
( IS_SERVLET_FILE ). All work that asks servlets from a model should be 
done in the separate thread. This work just (re-)assign  mentioned attribute.
Actually it is almost done at the moment. Some minor modifications are required.
Comment 13 Martin Janicek 2012-11-28 14:48:16 UTC
Ok, I have evaluated latest 5 snapshots (starting with 7.3dev and newer) and non of them is J2EE Maven related.

NPS 633532: comming from general maven but caused because NbMavenProject.doFireReload() is calling File.isDirectory which is waiting for almost 10s for WinNTFileSystem.getBooleanAttribute (I don't think we can fix this one)

NPS 628026: caused by html.editor (hint counting I guess)

NPS 618670: again comming from general maven but caused by IO operation

NPS 618617: caused by findbugs plugin analyzing code

NPS 614737: comming from j2ee.ejbverification

..so they are basically two performance issues that we should fix (html.editor.hint and j2ee.ejbverification) + ideally we can improve findbugs plugin

Reassigning to html.editor (NPS 628026) --> please evaluate and pass the issue to the j2ee.ejbverification owner (not sure who that is to be honest:))
Comment 14 Marek Fukala 2012-11-28 20:20:08 UTC
> Reassigning to html.editor (NPS 628026) --> please evaluate and pass the issue
> to the j2ee.ejbverification owner (not sure who that is to be honest:))

This one is a duplicate of issue 221841, passing to ejb
Comment 15 Martin Fousek 2012-11-29 08:57:01 UTC
> NPS 614737: comming from j2ee.ejbverification

There was unnecessary check which was causing such slowness although it was totally ok. On the other side the filesystem wasn't from the fastest one again. Anyway, the check was removed in web-main #39ffdf1b649c (hg.netbeans.org/web-main/rev/39ffdf1b649c).
Comment 16 Martin Fousek 2012-11-29 08:59:33 UTC
BTW, the issue #221421 was resolved as wontfix since I was not able to improve rest 2/3 of slowness caused by slow WinNT filesystem - so the fix belongs rather to this issue.