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.
Build: NetBeans IDE Dev (Build 200909071948) VM: Java HotSpot(TM) Client VM, 1.5.0_20-141, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_20-b02-315 OS: Mac OS X, 10.5.8, i386 User comments: project not usable after opening (fresh userdir) Maximum slowness yet reported was 17886 ms, average is 12991
raising to p2, since sometimes IDE freezes for > 20sec
Build: NetBeans IDE Dev (Build 200909032054) VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03 OS: Windows Vista, 6.1, x86 User Comments: Maximum slowness yet reported was 23403 ms, average is 11846
Created attachment 87326 [details] nps snapshot
This issue already has 6 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=158047
The AWT thread is parsing Java files from org.netbeans.modules.web.project.ui.SetExecutionUriAction.isServletFile(). This looks similar to issue 170141 that Denis fixed, however reports in this issue are after this fix. Denis, can you please investigate? Thanks.
Right, this is not related to first fix for 170141 . I have removed scanning jar files on each model access. This issue relates to the FIRST model access ( model is instantiated and search xml files in classpath ). All further model access should be quick. Actually I need steps to reproduce. It seems one need to change isServletFile method itself . But I need to understand how it was called ( which node was chosen and what action was performed ).
Performance problem with SetExecutionUriAction' ( which as I see is called frequently ) should be resolved in "enable()" method implementation. This method should work quickly . So its implementation should avoid call metamodel . I see two cases of servlet file appearance : - It was created inside NB. - Web project was created based on existed sources. I believe I have already handled first case . Attribute "org.netbeans.modules.web.IsServletFile" is set for java file if it was created as Servlet. Second case should be handled on Project creation stage. Project creation based on existed sources is time consuming task . So it can include scanning for servlet files declared in sources . Metamodel could be used here. For each found servlet file there should be set "org.netbeans.modules.web.IsServletFile" attribute . As result method "enable()" will check only presence of "org.netbeans.modules.web.IsServletFile" attribute. This is my suggestion. Probably there could be another approach.
Steps to reproduce: - have a full IDE (i used 200909071948) - disable/delete ergonomics cluster - start ide with fresh userdir - open project (web project, feel free to drop me an email, i can share exactly this one privately) -> ide freezes
This issue already has 8 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=158047
Created attachment 87459 [details] Screenshot of the relevant part of the snapshot
I just attached a screenshot that should make it easier to read this problem by casual readers. It looks like the AWT is waiting for the sources scanning, which happens in the parsing thread, correct? I was thinking the solution could be the following: detect if scanning is in progress, and if not, we should be able to get the correct results quite quickly from the metamodel. If scan is in progress, we should detect it and not wait for the scanning results, and just return false from SetExecutionUriAction.isServletFile(). This will not give us accurate results, but it should be fast enough, right? I was consulting this with Tomas Zezula and he says that you can detect if scan is in progress by using JavaSource.runWhenScanFinished (which in the JavaEE infrastructure is already used in AnnotationModelHelper.runJavaSourceTaskWhenScanFinished), which returns Future, and then using a timeout to get the result on the Future. Tomas/Denis, what do you think about this approach? Tomas, you also said it would be useful to have a utility method for this usecase, can you please elaborate what you had in mind? Thanks.
Petr, I have considered suggested approach from very beginning. But I have declined it as incorrect ( because result depends on time ). As you said it is not accurate : > This will not give us accurate results, but > it should be fast enough, right? Yes , such approach will fix the problem but it's like hack for me. As I understand Tools popup menu calls "enable()" method of its action each time when Node is focused. As result each time when Node is chosen in Project explorer "enable()" will be called. This method starts ask the metamodel . Even if the metamodel responds fast on further calls it is not good. "enable()" method is called in AWT thread so it should work quickly. Some time ago I have corrected "enable()" method . Before this correction "is servlet" check was performed for EACH node ! ( even for Folders, not java files , etc. ) So for EACH node metamodel was called. It was very bad. Currently only Java files are checked on "is servlet". So "enable()" method is called too frequently ( at least each Java file is under question ). As result I suggest to use attribute ( which is already exist ) for identifying file as servlet. Asking this attribute is very quick operation. One just need to set up this attribute accurately on servlet creation . Probably search for source code which can "create" servlet is not trivial. So my suggestion could be not simple task. So I will agree on suggested approach if there no other objections ( except mine ).
Sorry Denis, my explanation was not clear. I agree that your approach with attribute is correct, and we should use it. The check whether the file is Java file is also good. I was talking about the situation when we know it's a Java file, but the attribute was not computed yet and we need to compute it the first time. In that case, my suggestion is to spend some time trying to find out, and if we find out, write the attribute to use it next time. If we exceed the time, just return false.
Sorry Petr :) It seems my explanation is also not clear. My suggestion is: Use ONLY attribute as identification servlet file. "enable()" should not try to perform ANY computation . It should not ask metamodel at all. So only thing that do "enable()" is check special attribute . Nothing more. The question is : how this attribute appears for servlet ? Answer to this question is : attribute should be set each time when servlet file is created . So "is servlet" logic is completely moved out of "enable()" method to "factory" logic. One thing we need to care: handle all cases of servlet file "creation". I have already mentioned two cases of such creation. But I have missed possibility to declare existed Java file as servlet via XML editing. This case is not simple. One need to listen changes . So my suggestion is actually not simple :(
changeset: 144773:8f249a42d390 user: Denis Anisimov <ads@netbeans.org> date: Sat Sep 12 23:21:09 2009 +0400 summary: Fix for IZ#171708 - AWT thread blocked for 15766 ms. (project not usable after opening - fresh userdir) changeset: 144772:838a80760868 user: Denis Anisimov <ads@netbeans.org> date: Fri Sep 11 21:40:26 2009 +0400 summary: Fix for IZ#171708 - AWT thread blocked for 15766 ms. (project not usable after opening - fresh userdir)
Integrated into 'main-golden', will be available in build *200909151512* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/838a80760868 User: Denis Anisimov <ads@netbeans.org> Log: Fix for IZ#171708 - AWT thread blocked for 15766 ms. (project not usable after opening - fresh userdir)