RFR 8238579: HttpsURLConnection drops the timeout and hangs forever in read

Daniel Fuchs daniel.fuchs at oracle.com
Wed Feb 26 14:10:08 UTC 2020


Hi Vyom,

I tried out your patch and got no suspicious failures so
you have my review :-)

best regards,

-- daniel

On 15/02/2020 04:14, Vyom Tewari26 wrote:
> I'll get back to you when I have managed to find some
> cycles to do so.
> 
> best regards,
> 
> -- daniel
> 
> On 14/02/2020 04:57, Vyom Tiwari wrote:
>  > 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