RFR 8238579: HttpsURLConnection drops the timeout and hangs forever in read(Internet mail)
felixxfyang(杨晓峰)
felixxfyang at tencent.com
Fri Feb 14 06:28:36 UTC 2020
Hi Vyom,
The patch looks fine. Can you add a regression test for it?
Thanks,
Felix Yang
在 2020/2/14 下午1:01,“core-libs-dev 代表 Vyom Tiwari”<core-libs-dev-bounces at openjdk.java.net 代表 vyommani at gmail.com> 写入:
Hi All,
Please find the below fix which resolves the issue(
https://bugs.openjdk.java.net/browse/JDK-8238579).
"HttpURLConnection.writeRequests()" retry in case of any write failure,
during retry it creates new HttpsClient without connectTimeout &
readTimeout. Below fix sets the connect & read timeout.
Thanks,
Vyom
diff -r 7e6165c9c606
src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
---
a/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
Thu Feb 13 17:14:45 2020 -0800
+++
b/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
Fri Feb 14 10:11:06 2020 +0530
@@ -87,10 +87,15 @@
*/
public void setNewClient (URL url, boolean useCache)
throws IOException {
+ int readTimeout = getReadTimeout();
http = HttpsClient.New (getSSLSocketFactory(),
url,
getHostnameVerifier(),
- useCache, this);
+ null,
+ -1,
+ useCache,
+ getConnectTimeout(), this);
+ http.setReadTimeout(readTimeout);
((HttpsClient)http).afterConnect();
}
@@ -132,10 +137,14 @@
boolean useCache) throws IOException {
if (connected)
return;
- http = HttpsClient.New (getSSLSocketFactory(),
- url,
- getHostnameVerifier(),
- proxyHost, proxyPort, useCache, this);
+ int readTimeout = getReadTimeout();
+ http = HttpsClient.New(getSSLSocketFactory(),
+ url,
+ getHostnameVerifier(),
+ proxyHost, proxyPort,
+ useCache,
+ getConnectTimeout(), this);
+ http.setReadTimeout(readTimeout);
connected = true;
}
More information about the core-libs-dev
mailing list