Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Timed out while retrieving the attached javadoc...." #176

Closed
joewood opened this issue Mar 31, 2017 · 24 comments
Closed

Error "Timed out while retrieving the attached javadoc...." #176

joewood opened this issue Mar 31, 2017 · 24 comments

Comments

@joewood
Copy link

joewood commented Mar 31, 2017

While typing in the editor using regular packages I see this error. It appears that the Java extension is trying to access the JavaDoc data from the internet, but it isn't respecting the configured proxy setting in VSCode.

Environment

Operating System: RHEL2.7
JDK version:1.8
Visual Studio Code version: 1.10.2
Java extension version: 0.1.0
Steps To Reproduce

Type any code that uses the standard packages:

java.util.Collections.

I see the following error in the "Output Window" For "Language Support for Java"

[Error - 12:24:14 PM] Mar 31, 2017 8:39:36 AM Unable to resolve compilation
Timed out while retrieving the attached javadoc for Collections [in Collections.class [in java.util [in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/rt.jar]]] 
Java Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for Collections [in Collections.class [in java.util [in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/rt.jar]]] ]
	at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:909)
	at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1039)
	at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:717)
	at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:218)
	at org.eclipse.jdt.ls.core.internal.handlers.CompletionResolveHandler.resolve(CompletionResolveHandler.java:119)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$2(JDTLanguageServer.java:203)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
	at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

My user settings configured my proxy as follows - which works fine for all other operations:

    "http.proxyStrictSSL": false,
    "http.proxy": "http://mycorpproxy",
@fbricon
Copy link
Collaborator

fbricon commented Mar 31, 2017

can you try setting your proxy settings in ~/.m2/settings.xml?

@joewood
Copy link
Author

joewood commented Mar 31, 2017

Setting the maven proxy didn't seem to help. Still see the same error. I also have the proxy set on $JAVA_OPTS

@fbricon
Copy link
Collaborator

fbricon commented Apr 11, 2017

So, I'm not sure why JDT tries to download the sources of the JDK from the Internet by itself (what URL is it trying to reach?), but it's definitely outside of the m2e source download mechanism (hence ignores settings.xml).

Please try to set the proxy settings following these instructions.

@fbricon
Copy link
Collaborator

fbricon commented Apr 18, 2017

@joewood have you tried setting the proxy settings in java.jdt.ls.vmargs as per my last comment?

@joewood
Copy link
Author

joewood commented Apr 18, 2017

Hi @fbricon yes, tried that and no difference.

  "java.jdt.ls.vmargs":"-Dhttp.proxyHost=myproxy.com -Dhttp.proxyPort=82"

I also tried System.http.proxyHost and included the https version, also nothing.

@joewood
Copy link
Author

joewood commented Apr 18, 2017

If it helps, this is the from the log:

[Trace - 11:46:09 AM] Received notification 'window/logMessage'.
Params: {
    "type": 1,
    "message": "Apr 18, 2017 11:42:35 AM Unable to resolve compilation\nTimed out while retrieving the attached javadoc for AbstractExecutorService [in AbstractExecutorService.class [in java.util.concurrent [in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/rt.jar]]] \nJava Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for AbstractExecutorService [in AbstractExecutorService.class [in java.util.concurrent [in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/rt.jar]]] ]\n\tat org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:909)\n\tat org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1039)\n\tat org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:997)\n\tat org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:218)\n\tat org.eclipse.jdt.ls.core.internal.handlers.CompletionResolveHandler.resolve(CompletionResolveHandler.java:119)\n\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$2(JDTLanguageServer.java:203)\n\tat java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)\n\tat java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)\n\tat java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)\n\tat java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)\n\tat java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)\n\tat java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)\n"
}


[Error - 11:46:09 AM] Apr 18, 2017 11:42:35 AM Unable to resolve compilation
Timed out while retrieving the attached javadoc for AbstractExecutorService [in AbstractExecutorService.class [in java.util.concurrent [in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/rt.jar]]] 
Java Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for AbstractExecutorService [in AbstractExecutorService.class [in java.util.concurrent [in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/rt.jar]]] ]
	at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:909)
	at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1039)
	at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:997)
	at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:218)
	at org.eclipse.jdt.ls.core.internal.handlers.CompletionResolveHandler.resolve(CompletionResolveHandler.java:119)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$2(JDTLanguageServer.java:203)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
	at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

@fbricon
Copy link
Collaborator

fbricon commented Apr 18, 2017

mmm I was expecting these proxy settings passed as System properties to just work. I need to check with an actual proxy on my side.

@fbricon
Copy link
Collaborator

fbricon commented Apr 18, 2017

I checked setting the proxy settings via java.jdt.ls.vmargs works for me: the JDT LS server hits my local proxy.
Can you make sure running java code (from another IDE) with these settings actually work?

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;

public class ProxyTest {

	public static void main(String[] args) throws Exception {
		System.setProperty("http.proxyHost", "myproxy.com");
		System.setProperty("http.proxyPort", "82");
		System.setProperty("https.proxyHost", "myproxy.com");
		System.setProperty("https.proxyPort", "82");
		
		String target = "http://example.com";
		StringBuilder output = new StringBuilder();
		try (BufferedReader br = new BufferedReader(new InputStreamReader(new URL(target).openStream()))) {
			String response;
			while ((response = br.readLine()) != null) {
				output.append(response).append(System.lineSeparator());
			}
		}
		System.out.println(output);
	}
}

fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue Apr 18, 2017
Added a timeout of 500ms to javadoc resolution, so completionItem resolve regardless of javadoc status.
It should be noted, however, that 500ms might still be too long for client-side, which could still experience issues like
redhat-developer/vscode-java#176

Signed-off-by: Fred Bricon <fbricon@gmail.com>
fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue Apr 19, 2017
Added a timeout of 500ms to javadoc resolution, so completionItem resolve regardless of javadoc status.
It should be noted, however, that 500ms might still be too long for client-side, which could still experience issues like
redhat-developer/vscode-java#176

Signed-off-by: Fred Bricon <fbricon@gmail.com>
fbricon added a commit to fbricon/eclipse.jdt.ls that referenced this issue Apr 19, 2017
Added a timeout of 500ms to javadoc resolution, so completionItem resolve regardless of javadoc status.
It should be noted, however, that 500ms might still be too long for client-side, which could still experience issues like
redhat-developer/vscode-java#176

Signed-off-by: Fred Bricon <fbricon@gmail.com>
fbricon added a commit to eclipse-jdtls/eclipse.jdt.ls that referenced this issue Apr 19, 2017
Added a timeout of 500ms to javadoc resolution, so completionItem resolve regardless of javadoc status.
It should be noted, however, that 500ms might still be too long for client-side, which could still experience issues like
redhat-developer/vscode-java#176

Signed-off-by: Fred Bricon <fbricon@gmail.com>
@joewood
Copy link
Author

joewood commented Apr 28, 2017

Hi @fbricon sorry for the delay. Yes that test works as expected. Strange that it doesn't work through the extension.

@dineiar
Copy link

dineiar commented May 5, 2017

I have the same problem. I'm using proxy through cntlm and have the following proxy settings:
settings.json

{
    "http.proxy": "https://localhost:3128/",
    "java.jdt.ls.vmargs": "-noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=3128"
}

~/.m2/settings.xml

  <proxies>
    <proxy>
      <id>TRT4</id>
      <active>true</active>
      <protocol>https</protocol>
      <host>localhost</host>
      <port>3128</port>
      <nonProxyHosts>localhost</nonProxyHosts>
    </proxy>
  </proxies>

Bash shell export -p

http_proxy="http://localhost:3128/"
https_proxy="https://localhost:3128/"

Everything works (also confirmed that maven can download packages), except the Language Support for Java extension:

java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
	at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
	at org.gradle.wrapper.Download.downloadInternal(Download.java:60)
	at org.gradle.wrapper.Download.download(Download.java:45)
	at org.gradle.tooling.internal.consumer.DistributionFactory$ProgressReportingDownload.download(DistributionFactory.java:202)
	at org.gradle.wrapper.Install$1.call(Install.java:62)
	at org.gradle.wrapper.Install$1.call(Install.java:48)
	at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
	at org.gradle.wrapper.Install.createDist(Install.java:48)
	at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:139)
	at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:133)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

@dineiar
Copy link

dineiar commented May 25, 2017

I have noticed the proxy error occurs randomly and when I save the opened file. When I press Ctrl+S it shows me the error and underlines almost all code in red, saying it can't resolve names to classes.

If I go after a dot and start typing again, it reestablish the communication and it's all right again. Until the next save.

Is there any chance the code is ignoring proxy settings on "after save" hook or something like this?

@fbricon
Copy link
Collaborator

fbricon commented May 25, 2017

@dineiar we just fixed - hopefully- an issue with proxy settings being ignored server side.

Guys, please download and install the latest *.vsix from http://download.jboss.org/jbosstools/jdt.ls/staging/ and let us know if it fixes your issue

@dineiar
Copy link

dineiar commented May 25, 2017

Also, I'm seeing errors like this (just noticed the stack trace is different):

Unable to read documentation
Connection refused (Connection refused)
Java Model Exception: java.net.ConnectException: Connection refused (Connection refused)
	at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:918)
	at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1039)
	at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:717)
	at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:218)
	at org.eclipse.jdt.ls.core.internal.handlers.CompletionResolveHandler.lambda$0(CompletionResolveHandler.java:125)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:206)
	at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
	at org.eclipse.jdt.ls.core.internal.handlers.CompletionResolveHandler.resolve(CompletionResolveHandler.java:124)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$2(JDTLanguageServer.java:203)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
	at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

@dineiar
Copy link

dineiar commented May 25, 2017

@fbricon Just installed and it stopped popping up the Output window every 3 seconds, so thank you!

It still presenting that strange behaviour on save that I mentioned before, and showing lot of Graddle errors on output like

Synchronize Gradle projects with workspace failed due to an error in the referenced Gradle build.
Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.

But they don't bother much as the're not popping on the screen.

@fbricon
Copy link
Collaborator

fbricon commented May 25, 2017

@dineiar does it work with Eclipse+Gradle integration (aka Buildship)?

@snjeza
Copy link
Contributor

snjeza commented May 25, 2017

@dineiar You may want to take a look at eclipse-jdtls/eclipse.jdt.ls#233 (comment)

@snjeza
Copy link
Contributor

snjeza commented May 25, 2017

@dineier the following part is related to gradle:

There is also a problem when setting a proxy for gradle. It isn't related to o.e.jdt.ls or Eclipse/buildship.
When gradle downloads a gradle distribution, it requires setting the proxy properties as the following:

systemProp.http.proxyHost=user:password@<proxy_ip>
systemProp.http.proxyPort=
systemProp.https.proxyHost=user:<password@<proxy_ip>
systemProp.https.proxyPort=

However, when downloading dependencies, gradle requires the proxy properties to be set as described at https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy:

systemProp.http.proxyHost=<proxy_id>
systemProp.http.proxyPort=
systemProp.http.proxyUser=
systemProp.http.proxyPassword=
systemProp.https.proxyHost=<proxy_id>
systemProp.https.proxyPort=
systemProp.https.proxyUser=
systemProp.https.proxyPassword=

This fix will download dependencies, but won't work if there isn't the required gradle distribution. You have to download the distribution using gradle.properties as described above.

@dineiar
Copy link

dineiar commented May 25, 2017

@fbricon I'm not using Gradle, so I don't know. I'm using VS Code and Maven. (Did I misunderstood you question?)
@snjeza Hmmm that seems related.

I didn't fully understood the VS Code - Eclipse - Maven - Graddle relationship... Is the Java Plugin that creates the .settings folder and files org.eclipse.core.resources.prefs and org.eclipse.m2e.core.prefs? Maybe I should set the proxy on org.eclipse.m2e.core.prefs as well...? (from the @snjeza 's thread I understood that it would be done automatically)

@fbricon
Copy link
Collaborator

fbricon commented May 25, 2017

@dineiar your comment mentions gradle, so I assumed that's what you were using

files in .settings are generated by different plugins run by the server. For Maven project you need to set your proxy settings in settings.xml

@dineiar
Copy link

dineiar commented May 26, 2017

@fbricon I'm sorry I didn't let that clear in that comment.

The proxy settings are setted in Maven's settings.xml, as mentioned in my previous comment. What I still don't understand is why the extension keeps trying to synchronize Graddle, as I'm not using it in my projects...

@fbricon
Copy link
Collaborator

fbricon commented May 26, 2017

It's not normal. This should be fixed

@dineiar
Copy link

dineiar commented May 26, 2017

Should I open another issue for this?

At least for me, the javadoc proxy problem seems to be solved by the latest .vsix.

@fbricon
Copy link
Collaborator

fbricon commented May 26, 2017

Yes please

@fbricon fbricon added this to the End May 2017 milestone May 29, 2017
@fbricon
Copy link
Collaborator

fbricon commented May 29, 2017

This should be fixed along the proxy issues now. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants