Bug 219368 - Indefinite hang on HTTP connection to unresponsive site - back again [message #1767900] |
Wed, 12 July 2017 01:31  |
Eclipse User |
|
|
|
Hi,
I'm trying to isolate a problem a user has downloading plugins from a p2 repo. After much searching and debugging I finally came across https://bugs.eclipse.org/bugs/show_bug.cgi?id=219368.
So now I'm looking for some kind of confirmation of what I've found and whether a new bug needs to be raised.
So the above bug is exactly the problem we are experiencing. However, the fix that was applied no longer seems to work. I've found that the setting of the System properties doesn't apply to the created connection. This ties up with a SO question someone else found (https://stackoverflow.com/questions/39959775/httpurlconnection-timeout-not-working-by-setting-the-system-properties)
Looking at org/eclipse/ecf/provider/filetransfer/retrieve/UrlConnectionRetrieveFileTransfer.java , the connection is created as urlConnection = getRemoteFileURL().openConnection(); .
Trying a simple application, we can see the following:
System.setProperty("sun.net.client.defaultConnectTimeout", "120000");
System.setProperty("sun.net.client.defaultReadTimeout", "120000");
URL bundleUrl = new URL(BASEURL + "/plugins/" + bundleName);
URLConnection bundleUrlConn = bundleUrl.openConnection();
// Using the IDE you can see:
// bundleUrlConn.connectTimeout (HttpURLConnection)= -1
// bundleUrlConn.connectTimeout (URLConnection) = 0
// bundleUrlConn.readTimeout (HttpURLConnection)= -1
// bundleUrlConn.readTimeout (URLConnection) = 0
// So the following is required to set the properties correctly
bundleUrlConn.setConnectTimeout(10000);
bundleUrlConn.setReadTimeout(10000);
So I think the fix needs to be updated to use the set*Timeout methods. Does that sound about right?
Chris
|
|
|
|
|
|
Re: Bug 219368 - Indefinite hang on HTTP connection to unresponsive site - back again [message #1792922 is a reply to message #1768015] |
Wed, 25 July 2018 19:41  |
Eclipse User |
|
|
|
A year later I've got time to get back to this.
Looking over my bug ticket and re-reading this post I realized we were not even distributing the org.eclipse.ecf.provider.filetransfer.httpclient4 bundle with our software, hence it always used the "backup" urlconnection-based provider. Including the bundle with our software has it auto-magically picked up and used so now, although in this environment we still get hanging downloads, they do timeout correctly and eventually all downloads are successful.
Thanks for the help.
|
|
|
Powered by
FUDForum. Page generated in 0.02409 seconds