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 148786 - [65cat] ide freezes when asked for project properties when project scanning is already underway
Summary: [65cat] ide freezes when asked for project properties when project scanning i...
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Web Project (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-30 20:26 UTC by pbelbin
Modified: 2008-11-24 09:12 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
thread dump (39.19 KB, text/plain)
2008-10-01 20:19 UTC, David Konecny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pbelbin 2008-09-30 20:26:29 UTC
[ BUILD # : 200809300201 ]
[ JDK VERSION : 1.6.0_07 ]

I did a fresh install of a daily build, reusing a previous userdir.

I went into the tools->options, and re-enabled the tasklist scanning
functionality.

at this point, the 'scanning projects' info / activity indicator were
shown at the bottom right.

now, bring up the context menu for a project, and ask to see the
properties dialog.

at this point, the ide appears to freeze.

at some point later, I'm guessing after the scan was complete (which
took some time) the properties dialog box eventually appeared.

the ide took on the appearance that it had frozen completely, while
it really hadn't.
Comment 1 Milos Kleint 2008-10-01 07:08:54 UTC
what project type? which panel in the properties dialog was on top?

I guess some of the panels in the dialog want to access java infrastructure but that one is busy elsewhere.

or it's just a general resource limitation problem where the CPU is busy and can't process the dialog showing fast 

Comment 2 pbelbin 2008-10-01 16:40:03 UTC
I'm fairly sure the project was a web application project that I was using the context menu of.

I'm fairly sure it's not a simple CPU resource limit, as the workstation I'm using is a dual quad xeon (8 cpu).  now, 
whether java is imposing an artificial limit, I could not tell you.  

there could well be some blocking going on, and that is the point of the post.

the ide gave the appearance of being locked up.

the progress indicator stopped dead in it's tracks.

I would have thought that even if the appearance of the properties dialog was delayed due to blocking, that the screen 
updates to the ide should have continued to take place - ie: the cylon-esque progress/activity indicator for the scan 
at the bottom right should have kept going.
Comment 3 Milos Kleint 2008-10-01 17:02:41 UTC
it would help if you had reproducible steps, thread dumps or anything that would help up track down the problem. The
current description is a bit vague.

anyway, reassigning to web, as probably one of it's panels is the culprit here and is calling java/gsf infrastructure in
AWT.
Comment 4 David Konecny 2008-10-01 20:19:57 UTC
Created attachment 70993 [details]
thread dump
Comment 5 David Konecny 2008-10-01 20:29:59 UTC
I was able to reproduce it: start NB; create a Web Project; open some NB project with bunch of its subprojects. Opening
NB project should cause long classpath scanning after IDE startup and in that time open project properties of the Web
Project. UI gets frozen for a while and as can be seen from attached thread dump it is caused by Struts framework
request to Java parser infrastructure.

There is couple of possible solutions. First one I would like to investigate is to check whether Struts framework could
be less aggressive and perhaps just check web.xml for Struts framework detection in a project? Would that be possible?
Other solution would be to call framework detection in background thread and show "loading..." in UI until that's
finished. Doable but considering that WebFrameworkProvider.isInWebModule() can be called frequently it should be as
quick as possible.
Comment 6 pbelbin 2008-10-01 21:45:02 UTC
this is actually a P2 issue.

great work on reproducing the issue and getting a thread dump!
Comment 7 David Konecny 2008-10-01 22:32:19 UTC
I'm not sure about P2 - in my instance the dialog is frozen for about 3-5 seconds and then everything works fine again.
Also it happens only if scanning is running. In that respect it is still a valid issue but more of a P3 IMO.
Comment 8 _ potingwu 2008-10-02 00:52:09 UTC
> to check whether Struts framework could be less aggressive and perhaps just check web.xml for Struts framework

In JavaServer Faces framework, it does only check "javax.faces.webapp.FacesServlet" as an existing "ServletClass". While
in Struts framework, it does not only check "org.apache.struts.action.ActionServlet" as an existing "ServletClass", but
also check whether there is any subtype of "org.apache.struts.action.ActionServlet" as an existing "ServletClass"!

Petr, what do you think? I agree the Struts check is more complete but it may face more performance issues! Besides, is
there any use cases that users implement their own ActionServlet?
Comment 9 Petr Pisl 2008-10-02 12:12:22 UTC
This is very common usecase that org.apache.struts.action.ActionServlet is extended and such class is registered in
web.xml. So the check is correct and has to be there still. For javax.faces.webapp.FacesServlet we don't have to do the
same check, because the FacesServlet class is final, so nobody can extend this class. 
Comment 10 pbelbin 2008-10-02 15:05:34 UTC
the reason I say it's a P2 issue is due to the description of P2's:

performance:

UI responsiveness of a feature breaking UI guidelines (100ms, 1s) 
Significant scalability problem 
AWT thread blocked by a task which could run on background 
No or inappropriate indication of progress of a running task 

I'm pretty sure in my particular instance, that there are not any struts derivative classes in the particular projects 
I'm working with, but there may be a use case where others are, and expect it to behave correctly.  I suppose this is 
the struts way of figuring out what controller classes are out there, rather than having them specifically called out 
or registered in a control file of some sort.  perhaps that's part of the struts contract - to discover the struts 
controller classes.

I have quite a few classes amongst about 18 projects, and it takes considerably longer in my case for the scanning to 
be completed.  The more classes there are, the longer it will take.

having this take place on a worker thread seems like a good idea as long as there isn't a dependancy on the result 
being available before the user has the opportunity to do something in the ide....

Comment 11 David Konecny 2008-10-02 20:09:49 UTC
I will have a look how easy/difficult would it be fixing this on Web project side and calling
WebFrameworkProvider.isInWebModule() in a backgrdound thread. Considering we are close to code-freeze if fix is too
complicated it may not be fixed for 6.5. The fix has associated UI change in frameworks list being loaded on demand but
that should be acceptable despite being in UI freeze.
Comment 12 _ potingwu 2008-10-02 21:10:08 UTC
I have committed an improvement (details: http://hg.netbeans.org/main?cmd=changeset;node=791bb0f079e8) from the Struts
module: When there is NO servlets in web.xml, should not call JavaSource.runUserActionTask, returns null immediately.

This will make David's test case no longer reproducible! Good to many users' environment, bad to our further test. But
we can make it reproducible again by changing David's reproducible steps: 'create a web project with JSF framework'
instead of just a web project without any framework. Then the test web project will have non-zero length servlets in the
web.xml and then causes the delay we have seen.
Comment 13 _ potingwu 2008-10-02 21:17:35 UTC
David, since I cannot easily find further improvement in Struts, at least for 6.5 without making big change, I agree
that the UI post needs to be done from the web project layer. I think we may decrease it to P3 after my Struts
improvement, especially for the need of changing UI.
Comment 14 _ potingwu 2008-10-02 21:21:31 UTC
For unknown reason, the issue changed the platform wrongly!
Comment 15 David Konecny 2008-10-02 21:36:30 UTC
potingwu, that will help in cases where user does not have any servlet. I would argue though that it will be minority of
cases. You cannot anything useful without servlet in web app.

I think I can slightly improve the situation as well with a fix in the web project. I'm working on it right now.
Comment 16 David Konecny 2008-10-02 23:47:28 UTC
Fixed locally as 1bda3d0ec086. Loading of frameworks is done in background thread and text "Loading..." is shown in
Frameworks panels in project properties if scanning is running on background.
Comment 17 Quality Engineering 2008-10-03 14:35:41 UTC
Integrated into 'main-golden', will be available in build *200810031107* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/791bb0f079e8
User: potingwu@netbeans.org
Log: Improve Issue#148786, P2, [65cat] ide freezes when asked for project properties when project scanning is already underway.
When there is NO servlets in web.xml, should not call JavaSource.runUserActionTask, returns null immediately.
Comment 18 pbelbin 2008-10-03 15:00:37 UTC
thank you!  that should help quite a bit.
Comment 19 martin_zmrhal 2008-11-24 09:12:33 UTC
No freeze observed. Verified.

Product Version: NetBeans IDE Dev (Build 200811240201)
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.27-7-generic running on i386; UTF-8; en_US (nb)