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 187919 - 6s in java.source.ui.ElementJavadoc.resolveLink()
Summary: 6s in java.source.ui.ElementJavadoc.resolveLink()
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Javadoc (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: Jesse Glick
URL:
Keywords: PERFORMANCE, REGRESSION
: 191177 193386 (view as bug list)
Depends on: 191914
Blocks: 41443
  Show dependency tree
 
Reported: 2010-06-22 05:09 UTC by Petr Jiricka
Modified: 2011-02-02 06:19 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 169672


Attachments
nps snapshot (5.03 KB, application/nps)
2010-06-22 05:09 UTC, Petr Jiricka
Details
AWT event queue stack trace (6.29 KB, text/plain)
2010-07-29 14:45 UTC, Petr Jiricka
Details
nps snapshot (9.96 KB, application/nps)
2010-12-10 12:21 UTC, Exceptions Reporter
Details
nps snapshot (12.72 KB, application/nps)
2010-12-20 09:15 UTC, Exceptions Reporter
Details
Sketch of code completion patch - not very nice (42.38 KB, patch)
2011-02-01 18:30 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2010-06-22 05:09:36 UTC
This issue was reported manually by pjiricka.
It already has 2 duplicates 


Build: NetBeans IDE Dev (Build web-main-3385-on-100618)
VM: Java HotSpot(TM) 64-Bit Server VM, 16.3-b01-279, Java(TM) SE Runtime Environment, 1.6.0_20-b02-279-9M3165
OS: Mac OS X

User Comments:
tnleeuw: Code completion in Java.
Previously there was slow AWT response after opening a Java file and trying to close a node in the Project tree.

pjiricka: Navigating in Javadoc inside the code completion documentation window, for remote Javadoc.



Maximum slowness yet reported was 6324 ms, average is 5109
Comment 1 Petr Jiricka 2010-06-22 05:09:40 UTC
Created attachment 100299 [details]
nps snapshot
Comment 2 Petr Jiricka 2010-07-29 14:45:56 UTC
Created attachment 101086 [details]
AWT event queue stack trace

I am attaching another case where remote Javadoc is accessed from AWT event queue.
Comment 3 Jesse Glick 2010-09-17 18:40:17 UTC
Either NbGenerateCodeAction.actionPerformed should run asynch, or TreeLoader.getParamNamesFromJavadocText should skip remote URLs.
Comment 4 Jan Becicka 2010-10-08 07:53:37 UTC
Jesse, this bug is assigned to you intentionally, or by accident? Do you plan to fix it?
Comment 5 Jesse Glick 2010-10-08 16:05:02 UTC
Assigned to me since I implemented the HTTP Javadoc support. I don't know yet if I will get to it in 7.0.
Comment 6 Jesse Glick 2010-10-20 15:11:19 UTC
*** Bug 191177 has been marked as a duplicate of this bug. ***
Comment 7 Jesse Glick 2010-11-16 17:46:38 UTC
The stack trace should be fixed by bug #191914. Other snapshots may be different issues.
Comment 8 Exceptions Reporter 2010-12-10 12:21:58 UTC
Created attachment 103932 [details]
nps snapshot

alt+inser in a java class.
Comment 9 Exceptions Reporter 2010-12-20 09:15:12 UTC
Created attachment 104298 [details]
nps snapshot

pressed "alt+inser" in an 20 lines class extending Exception
Comment 10 Dusan Balek 2011-01-12 10:49:46 UTC
*** Bug 193386 has been marked as a duplicate of this bug. ***
Comment 11 Tomas Danek 2011-01-17 15:50:51 UTC
#20110117

Big performance problem from my point of view, CC window did not display on my mac at all (i.e. i took > 15s) Finally from selfprofiler i was able to find root cause - reading remote javadoc.
IMO this affects all mac user in very significant way, loading of remote javadoc should not block CC. 
At least there is now a possibility to remove default javadoc (#191914)
Comment 12 Jesse Glick 2011-01-19 14:39:34 UTC
Snapshots from exception reporter look to be mixing two unrelated things. Probably Version should really be 7.0 but I don't know.
Comment 13 Jesse Glick 2011-02-01 12:56:28 UTC
core-main #4fe3904e507a
Comment 14 Tomas Zezula 2011-02-01 16:06:41 UTC
I doubt this solves all reported problems. It solves the click in the DocumentationScrollPane, but it does not solve the completion window showing javadoc reported for example by Tomas Musil #20110117

Here is a stack trace:
"Code Completion" daemon prio=1 tid=101a36800 nid=0x1728b3000 runnable [1728b0000]
   java.lang.Thread.State: RUNNABLE
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	- locked <106a1e168> (a java.net.PlainSocketImpl)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.Socket.connect(Socket.java:529)
	at java.net.Socket.connect(Socket.java:478)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
	at sun.net.www.http.HttpClient$4.run(HttpClient.java:457)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:439)
	- locked <106a1dd90> (a sun.net.www.http.HttpClient)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:520)
	- locked <106a1dd90> (a sun.net.www.http.HttpClient)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
	at sun.net.www.http.HttpClient.New(HttpClient.java:306)
	at sun.net.www.http.HttpClient.New(HttpClient.java:323)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:975)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:916)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1177)
	- locked <1068c16c0> (a sun.net.www.protocol.http.HttpURLConnection)
	at java.net.URL.openStream(URL.java:1010)
	at org.netbeans.modules.java.source.JavadocHelper.openStream(JavadocHelper.java:190)
	at org.netbeans.modules.java.source.JavadocHelper$TextStream.openStream(JavadocHelper.java:156)
	- locked <1068c1698> (a org.netbeans.modules.java.source.JavadocHelper$TextStream)
	at org.netbeans.api.java.source.ui.HTMLJavadocParser.getJavadocText(HTMLJavadocParser.java:91)
	at org.netbeans.api.java.source.ui.HTMLJavadocParser.getJavadocText(HTMLJavadocParser.java:75)
	at org.netbeans.api.java.source.ui.ElementJavadoc.inheritedDocFor(ElementJavadoc.java:1387)
	at org.netbeans.api.java.source.ui.ElementJavadoc.prepareContent(ElementJavadoc.java:483)
	at org.netbeans.api.java.source.ui.ElementJavadoc.<init>(ElementJavadoc.java:303)
	at org.netbeans.api.java.source.ui.ElementJavadoc.create(ElementJavadoc.java:147)
	at org.netbeans.modules.editor.java.JavaCompletionDoc.create(JavaCompletionDoc.java:90)
	at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.resolveDocumentation(JavaCompletionProvider.java:561)
	at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.run(JavaCompletionProvider.java:396)
	at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery$Task.run(JavaCompletionProvider.java:4903)
	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$1.call(TaskProcessor.java:201)
	at org.netbeans.modules.parsing.impl.TaskProcessor$1.call(TaskProcessor.java:198)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:167)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:323)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:66)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:198)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runWhenScanFinished(TaskProcessor.java:235)
	at org.netbeans.modules.parsing.api.ParserManager.parseWhenScanFinished(ParserManager.java:131)
	at org.netbeans.modules.editor.java.JavaCompletionProvider$JavaCompletionQuery.query(JavaCompletionProvider.java:288)
	at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:223)
Comment 15 Jesse Glick 2011-02-01 18:30:08 UTC
I can't reproduce any stack trace of that kind; I tried Javadoc completion in a variety of contexts and it was fine. If something is still broken, there should be an assertion error for it, so it will get filed separately.
Comment 16 Tomas Zezula 2011-02-01 18:30:48 UTC
Created attachment 105562 [details]
Sketch of code completion patch - not very nice
Comment 17 Tomas Zezula 2011-02-01 18:36:10 UTC
No, the assertion is not thrown.
The problem is different. The code completion is not called by AWT but it's called under parser lock.
The http request is done under the lock => other thread (including AWT) is blocked when ever it touches the parser lock.
The assert has to be extend by !JavaSourceAccessor.holdsParserLock()
Comment 18 Tomas Zezula 2011-02-01 19:02:24 UTC
As this covers several problems, I propose to split this issue.
The AWT hang when clicked in the doc - fixed.

The Tomas Musil case
<cite>
#20110117
Big performance problem from my point of view, CC window did not display on my
mac at all (i.e. i took > 15s) Finally from selfprofiler i was able to find
root cause - reading remote javadoc.
IMO this affects all mac user in very significant way, loading of remote
javadoc should not block CC. 
At least there is now a possibility to remove default javadoc (#191914
</cite>

I will create a separate issue for it and close this as fixed.
OK?
Comment 19 Jesse Glick 2011-02-01 19:06:41 UTC
(In reply to comment #18)
> I will create a separate issue for it and close this as fixed.

Agreed, that should make it easier to track.
Comment 20 Tomas Zezula 2011-02-01 19:12:55 UTC
I've created a new issue #194969.
Marking as fixed.
Comment 21 Quality Engineering 2011-02-02 06:19:41 UTC
Integrated into 'main-golden', will be available in build *201102020000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/4fe3904e507a
User: Jesse Glick <jglick@netbeans.org>
Log: #187919: 6s in java.source.ui.ElementJavadoc.resolveLink()
I think fixing all issues not already addressed by #191914.
Also introducing an assertion, so that users of dev builds will help track down any
remaining problems much more easily and reliably than with the slowness detector.