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 137554 - Opening "New Libraries Folder" takes few seconds - org.netbeans.modules.clearcase.client.Cleartool.createCleartoolProcess in AWT
Summary: Opening "New Libraries Folder" takes few seconds - org.netbeans.modules.clear...
Status: VERIFIED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@versioncontrol
URL:
Keywords: PERFORMANCE
Depends on: 137822
Blocks:
  Show dependency tree
 
Reported: 2008-06-18 12:13 UTC by Marian Mirilovic
Modified: 2008-07-24 09:01 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
thread-dump (23.33 KB, text/plain)
2008-06-18 12:13 UTC, Marian Mirilovic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Mirilovic 2008-06-18 12:13:20 UTC
Product Version: NetBeans IDE Dev (Build 200806180005)
Java: 1.6.0_10-beta; Java HotSpot(TM) 64-Bit Server VM 11.0-b12
System: Linux version 2.6.24-19-generic running on amd64; UTF-8; en_US (nb)

+ installed clearcase from UC ...

Steps to reproduce:
- create new J2SE project
- open properties for project node
- select "Libraries" and push "Browse..." button beside Libraries Folder textfield
-> opening dialog takes couple of seconds - I was able to switch to console and generate thread-dump (see attachment)

It looks like cleartool is running in AWT even if I do not have the project versioned and I do not have installed
clearcase runtime :
"AWT-EventQueue-1" prio=10 tid=0x00007fad41dfa800 nid=0x5294 in Object.wait() [0x0000000042ac7000..0x0000000042ac9a20]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x00007fad7192d170> (a java.lang.UNIXProcess$Gate)
	at java.lang.Object.wait(Object.java:485)
	at java.lang.UNIXProcess$Gate.waitForExit(UNIXProcess.java:64)
	- locked <0x00007fad7192d170> (a java.lang.UNIXProcess$Gate)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:145)
	at java.lang.ProcessImpl.start(ProcessImpl.java:65)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
	at java.lang.Runtime.exec(Runtime.java:593)
	at java.lang.Runtime.exec(Runtime.java:431)
	at java.lang.Runtime.exec(Runtime.java:328)
	at org.netbeans.modules.clearcase.client.Cleartool.createCleartoolProcess(Cleartool.java:152)
	at org.netbeans.modules.clearcase.client.Cleartool.<init>(Cleartool.java:76)
	at org.netbeans.modules.clearcase.client.ClearcaseClient.ensureCleartool(ClearcaseClient.java:385)
	at org.netbeans.modules.clearcase.client.ClearcaseClient.access$000(ClearcaseClient.java:74)
	at org.netbeans.modules.clearcase.client.ClearcaseClient$CommandRunnable.run(ClearcaseClient.java:199)
	at org.netbeans.modules.clearcase.client.ClearcaseClient.execImpl(ClearcaseClient.java:148)
	at org.netbeans.modules.clearcase.client.ClearcaseClient.exec(ClearcaseClient.java:128)
	at org.netbeans.modules.clearcase.client.ClearcaseClient.exec(ClearcaseClient.java:118)
	at org.netbeans.modules.clearcase.Clearcase.getTopmostManagedParent(Clearcase.java:257)
	at org.netbeans.modules.clearcase.ClearcaseVCS.getTopmostManagedAncestor(ClearcaseVCS.java:87)
	at org.netbeans.modules.clearcase.ClearcaseVCS.areCollocated(ClearcaseVCS.java:107)
	at org.netbeans.api.queries.CollocationQuery.areCollocated(CollocationQuery.java:81)
	at org.netbeans.spi.java.project.support.ui.MakeSharableVisualPanel1.isValidPanel(MakeSharableVisualPanel1.java:99)
	at org.netbeans.spi.java.project.support.ui.MakeSharableWizardPanel1.isValid(MakeSharableWizardPanel1.java:75)
	at org.openide.WizardDescriptor.updateStateInAWT(WizardDescriptor.java:869)
Comment 1 Marian Mirilovic 2008-06-18 12:13:50 UTC
Created attachment 62985 [details]
thread-dump
Comment 2 Maros Sandor 2008-06-18 14:04:29 UTC
To properly answer the collocation query the clearcase module has to execute the 'cleartool' process. So the solution to
this is to avoid calling collocation query in awt. Reassigning for evaluation.
Comment 3 Jan Becicka 2008-06-18 14:22:53 UTC
Milosi, please take a look at it. Thanks.
Comment 4 Tomas Zezula 2008-06-18 16:36:23 UTC
Introduced by shared libraries.
SharableLibrariesWizard and SharableLibrariesPanel should call call CQ outside awt.
Shouldn't the clearcase provide the resut of CQ from cache?
 
Comment 5 David Konecny 2008-06-18 22:21:22 UTC
Re. "Shouldn't the clearcase provide the resut of CQ from cache?" - I think so. The CQ implementation should be as quick
as possible as Query is or can be used in AWT thread throughout the IDE. We could fix this instance
(MakeSharableVisualPanel) but I'm sure there will be others. This code has been there since 6.1 and there were no
problems with other VCS systems.

Passing back to clearcase for evaluation of caching options. Does running cleartool gives you list of checkout roots? If
so perhaps you could call it in background after IDE startup and cache the result? Just brainstorming.
Comment 6 Maros Sandor 2008-06-19 09:24:15 UTC
Re. "Shouldn't the clearcase provide the resut of CQ from cache?" - I think so.
Yes, we could cache CQ results or similar data ... the first query would still be slow though.

The CQ implementation should be as quick as possible as Query is or can be used in AWT thread throughout the IDE.
You are calling some unknown code, why are you making assumptions it is so fast it can be safely run in AWT? Take the
infamous SharabilityQuery as an example. Not only is it slow but it is generally unsafe to call it from any callback
thread, not speaking about EDT.

We could fix this instance (MakeSharableVisualPanel) but I'm sure there will be others. This code has been there since
6.1 and there were no problems with other VCS systems.
Other system just browse disk structures which is faster than talking over the network, which is the case of clearcase.

Does running cleartool gives you list of checkout roots?
It unfortunately does not. We will think about caching something so subsequent CQs run faster.

However, I still think that the primary cause of this issue is calling the query in EDT. You can you the
AsynchronousValidatingPanel to validate the input outside EDT.
Comment 7 Tomas Stupka 2008-06-19 10:06:22 UTC
> Shouldn't the clearcase provide the resut of CQ from cache?
There always will be situations when nothing isn't cached yet...

> Does running cleartool gives you list of checkout roots?
> It unfortunately does not. We will think about caching something so subsequent CQs run faster.
the thing is we have to do it the hard way - run a set o commands to find out what is the root from a cc view and as far
i know we already cache other results from previous getTopmostManagedParent calls. However, i will peek into the code if
there is a chance to improve something...

> The CQ implementation should be as quick as possible as Query is or can be used in AWT thread throughout the IDE.
agree with maros at this point - you never know how long it will take vcs to retrieve the needed data
Comment 8 Jesse Glick 2008-06-19 22:42:44 UTC
I doubt it is practical for every caller of CQ to do so asynchronously. Much better if the clearcase module can keep a
cache that makes the call fast in most cases, and user will just have to deal with a short freeze for other cases.
Comment 9 Tomas Stupka 2008-06-20 10:16:16 UTC
> much better if the clearcase module can keep a cache that makes the call fast in most cases, 
we already do that
> and user will just have to deal with a short freeze for other cases.
just for the record - cleartool contacts the server (if we like it or not), there is no guarantee it always will be a short one...


Comment 10 Maros Sandor 2008-06-20 13:01:42 UTC
After a bit of struggle we found out why this happens. First of all, ClearcaseVCS.areCollocated() should NOT be called
by the CollocationQuery. The problem is that CollocationQuery queries ClearcaseVCS in spite of the fact that it is NOT
registered in META-INF/services as a CollocationQueryImplementation. It IS in fact registered but only as a
VersioningSystem and just happens to implement the CollocationQueryImplementation. Yarda told us that this is an
unfortunate misfeature of the Lookup implementation and nothing can be done about it. So we will think about a way to
work around this on our side.

BTW, while debugging the code we saw that the wizard is calling CQ with nonexistent, bogus folders which also slows
things down. CQ.isCollocated("Y:\lib", "Y:\vob1\lib") where "Y:\lib" does not exist and the wizard was given
"Y:\vob1\lib" as the library folder. I'd recommend you check your code or file a bug.
Comment 11 Jesse Glick 2008-06-20 15:03:53 UTC
Regarding Lookup: I guess you mean that if you have

---%<--- META-INF/services/A
C
---%<---
public class C implements A, B {}
---%<---

then Lookup.getDefault().lookup(B.class) will normally return null, but will return C in case someone has previously
called Lookup.getDefault().lookup(A.class)? If so, ugly indeed - a byproduct of the fact that Lookup was designed to
mirror the Java type hierarchy even though this has little or no benefit for its users and does not work well with
META-INF/services.


"the wizard is calling CQ with nonexistent, bogus folders" - please file a separate bug for this so it does not get
forgotten. If you ran across this in the debugger, you will be the best person to file it.
Comment 12 Maros Sandor 2008-06-20 15:08:35 UTC
jglick: yes, this is what's happening
Comment 13 David Konecny 2008-06-22 22:12:03 UTC
Re. "CQ with nonexistent, bogus folders" - MakeSharableVisualPanel1 calls CQ on Libraries Folder location specified by
user which very likely does not exist. The purpose is to warn user if location is not collocated with the project.
That's something for Milos to fix. Though I would thought it is OK to call CQ with non-existing folder. 
Comment 14 Maros Sandor 2008-06-27 10:29:02 UTC
Versioning systems no longer implement CQI.
bff70e9c7b9a
Comment 15 Quality Engineering 2008-06-27 16:29:03 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #285 build
Changeset: http://hg.netbeans.org/main/rev/bff70e9c7b9a
User: Maros Sandor <msandor@netbeans.org>
Log: #137554: Versioning systems no longer implement CQ
Comment 16 Marian Mirilovic 2008-07-24 09:01:32 UTC
verified in NB Dev (20080724)