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 51651 - Running headless build of opened project(s) provokes frequent classpath rescans in IDE
Summary: Running headless build of opened project(s) provokes frequent classpath resca...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: issues@java
URL:
Keywords: USABILITY
: 50972 51719 51721 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-18 15:22 UTC by Antonin Nebuzelsky
Modified: 2007-09-26 09:14 UTC (History)
4 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 Antonin Nebuzelsky 2004-11-18 15:22:29 UTC
When you are working on a project in the IDE and
you run headless build of the project externally
using ant on a command line, the IDE invokes modal
classpath rescan whenever it detects a change in
classpaths.

This may become very annoying when you are using
"focus follows mouse" setting in your window
manager and point with the mouse cursor out of and
back into the IDE's main window frequently.
Comment 1 Martin Matula 2004-11-23 13:07:52 UTC
*** Issue 51719 has been marked as a duplicate of this issue. ***
Comment 2 Jesse Glick 2004-11-24 14:46:01 UTC
*** Issue 51721 has been marked as a duplicate of this issue. ***
Comment 3 Jesse Glick 2004-11-24 15:07:47 UTC
Can also apparently grab focus from external applications, even after
the dialog closes. Note also that the rescan occurs just as much for
in-IDE builds, which can also be a problem if you have switched to
another app while the build is running.

One thing which is curious is that if project A depends on project B,
i.e. CP(A/src,COMPILE) = B/dist/b.jar, rebuilding B causes a rescan of
b.jar for A's benefit, even though all the sources for b.jar are in
B/src and have not changed during the build. This seems to be an
artifact of the fact that the javacore infrastructure ignores
SourceForBinaryQuery in this respect: both B/src and B/dist/b.jar are
*independently* scanned (have their own indexes). If javacore were to
somehow skip (re-)scanning for b.jar, just using B/src's index
instead, this problem would probably not appear in normal usage - only
if your build actually recreated a JAR file with no source
association, which is never done by the default targets in j2seproject
and relatively rare even in customized build scripts.

A general UI rule is that dialogs should not pop up asynchronously,
i.e. not in direct (~ 200 msec) response to a user input event.
Classpath scanning dialogs do not violate this when they occur in
response to a user-initiated change in settings (e.g. open a project,
or closing a project properties dialog after making changes to the
classpath), but they do violate this rule when they occur in response
to timestamp changes on classpath JARs.

I am not sure what to suggest, since the current locking model for
MDR/JMI seems to make it impossible to do background scans without
potentially blocking EQ during common user actions or even editor
repaints. Perhaps it is possible to do synchronous (in-EQ) scans of
limited chunks of the classpath (e.g. at most 50 *.class files, or at
most 10 *.java files), leaving EQ open for user interaction (perhaps
running selected scans synch as needed) and repaints between bursts of
activity. This would require that locking be per class, not per
database or global, but from what I know of the JMI storage and
indices, that would not be a big problem. It would mean that the
dreaded classpath scanning dialog would go away and be replaced by
e.g. status-line notification that scanning was in progress; during a
scan, it would be possible to work with the IDE, but not at full speed.

Another possibility is to use a nonnative dialog inside the MDI window
to indicate classpath scanning. This is possible using a glass pane, I
think. You could dim (alpha-blend) the rest of the UI behind it to
make it obvious that you have to wait. Functionally it would work
exactly as the current dialog does, but would not interact with the
native window manager's idea of the current focussed window, which
would be an improvement. Ideally o.o.awt.DialogDisplayer would have an
option to display a lightweight rather than native dialog.
Comment 4 Martin Matula 2004-11-24 15:24:17 UTC
> If javacore were to
> somehow skip (re-)scanning for b.jar, just using B/src's index
> instead, this problem would probably not appear in normal usage

That's how we plan to fix this.

> I am not sure what to suggest, since the current locking model for
> MDR/JMI seems to make it impossible to do background scans without
> potentially blocking EQ during common user actions or even editor
> repaints.

Not true for scanning - the scanner releases the transaction anytime
it finds out the EQ is waiting for it and reacquires it when the EQ is
done. So, we can do it on the background. The reason why we are not
doing it on the background is we did not make a special case for
scanning in response to a timestamp change - i.e. the same code is
used for the scan during the ide startup and the scan during the
timestamp change.
Comment 5 Jan Chalupa 2004-12-08 05:51:59 UTC
Waiver approved for 4.0.
Comment 6 Martin Matula 2004-12-14 17:06:08 UTC
Fixed.

  Revision  Changes    Path
  1.12      +11 -15   
java/javacore/src/org/netbeans/modules/javacore/classpath/MergedClassPathImplementation.java
 
Comment 7 Antonin Nebuzelsky 2005-01-07 12:04:27 UTC
I still see the same behavior. Scanning progress dialog pops up when I
run "cvs update; ant buildnozip" externally. It pops up both during
the cvs update (when java files are modified on disk) and during the
external ant execution (when jars on disk are modified).
Comment 8 Martin Matula 2005-01-10 09:02:37 UTC
We have fixed unnecessary scanning of class files if there are sources
on the classpath. So now you get the scanning dialog only when you
change jars that do not have corresponding sources (e.g. jars from
external binaries). I don't see how we can fix this unless we make the
scanning non-modal. As we agreed at the last performance meeting, we
will not make it non-modal for 4.1. I suggest lowering priority of
this bug to P3 since the most common problem (with scanning jar files
that are result of compilation of project sources) is fixed. Any
objections?
Comment 9 Martin Matula 2005-01-17 17:31:12 UTC
No objections -> priority lowered.
Comment 10 Martin Matula 2005-01-19 09:05:26 UTC
*** Issue 50972 has been marked as a duplicate of this issue. ***
Comment 11 Jan Becicka 2005-02-15 09:23:51 UTC
There is a new switch
-J-Dnetbeans.javacore.background_scanning=true
which forces IDE to do scanning on background.
This switch is experimental (not official) and bugs related to this
switch can be closed as WONTFIX (for now). Anyway we appreciate your
feedback (preferably add your experiences and opinions as a comments
to issue 43909).

Known issues: code completion, code folds and all stuff requiring java
model access are postponed till scanning is finished.
Comment 12 David Simonek 2005-02-15 11:59:35 UTC
Navigator postponed as well.
Comment 13 Martin Matula 2005-03-16 23:19:36 UTC
As I noted previously, we did fix the unnecessary scanning of build products.
The remaining things that are being scanned during build are external binaries
if they are unscrambled - the things that the IDE does not have sources for.
This cannot be avoided, so I am closing this as FIXED as a whole (since we fixed
the part that could be fixed - the remaining part cannot be fixed).
Comment 14 Quality Engineering 2007-09-20 12:00:14 UTC
Reorganization of java component