java.io.IOException: Retry limit exceeded at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:170) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257)

JDK Bug System | John Jiang | 3 months ago
  1. 0

    Currently, property java.net.httpclient.redirects.retrylimit affects not only redirection limit, but also re-connection limit. That may be confusing. Redirection and re-connection have different meanings. Please consider the below test: import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpClient.Redirect; import java.net.http.HttpRequest; import java.net.http.HttpResponse; public class SimpleRedirectTest { public static void main(String[] args) throws Exception { System.setProperty("java.net.httpclient.redirects.retrylimit", "0"); String url = "..."; HttpClient client = HttpClient.create().followRedirects(Redirect.ALWAYS).build(); HttpRequest request = client.request(new URI(url)).GET(); HttpResponse<String> response = request.response(HttpResponse.BodyHandler.discard("BODY")); System.out.println(response.statusCode()); } } The test raises the following exception: Exception in thread "main" java.io.IOException: Retry limit exceeded at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:170) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257) at SimpleRedirectTest.main(SimpleRedirectTest.java:17) The exception is thrown while connecting the server, but the test only focus on redirection. It would be better use two different properties for redirection limit and re-connection limit.

    JDK Bug System | 3 months ago | John Jiang
    java.io.IOException: Retry limit exceeded at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:170) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257)
  2. 0

    If the request includes body, when HTTP_2 client tries to access server over HTTPS, it may throw the following two exceptions: Exception in thread "main" java.io.IOException: Queue closed at sun.net.httpclient.common.Queue.take(java.httpclient@9-internal/Queue.java:113) at java.net.http.Stream.lambda$receiveData$1(java.httpclient@9-internal/Stream.java:203) at java.net.http.Stream.executeInline(java.httpclient@9-internal/Stream.java:179) at java.net.http.Stream.receiveData(java.httpclient@9-internal/Stream.java:197) at java.net.http.Stream.readBodyAsync(java.httpclient@9-internal/Stream.java:154) at java.net.http.Stream.readBody(java.httpclient@9-internal/Stream.java:168) at java.net.http.Exchange.readBody(java.httpclient@9-internal/Exchange.java:132) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:155) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257) at SimpleSslTest.test(SimpleSslTest.java:37) at SimpleSslTest.main(SimpleSslTest.java:24) Exception in thread "main" java.io.IOException: stream closed at sun.net.httpclient.common.Queue.take(java.httpclient@9-internal/Queue.java:106) at java.net.http.Stream.lambda$receiveData$1(java.httpclient@9-internal/Stream.java:203) at java.net.http.Stream.executeInline(java.httpclient@9-internal/Stream.java:179) at java.net.http.Stream.receiveData(java.httpclient@9-internal/Stream.java:197) at java.net.http.Stream.readBodyAsync(java.httpclient@9-internal/Stream.java:154) at java.net.http.Stream.readBody(java.httpclient@9-internal/Stream.java:168) at java.net.http.Exchange.readBody(java.httpclient@9-internal/Exchange.java:132) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:155) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257) at SimpleSslTest.test(SimpleSslTest.java:37) at SimpleSslTest.main(SimpleSslTest.java:24)

    JDK Bug System | 3 months ago | John Jiang
    java.io.IOException: Queue closed at sun.net.httpclient.common.Queue.take(java.httpclient@9-internal/Queue.java:113) at java.net.http.Stream.lambda$receiveData$1(java.httpclient@9-internal/Stream.java:203) at java.net.http.Stream.executeInline(java.httpclient@9-internal/Stream.java:179) at java.net.http.Stream.receiveData(java.httpclient@9-internal/Stream.java:197) at java.net.http.Stream.readBodyAsync(java.httpclient@9-internal/Stream.java:154) at java.net.http.Stream.readBody(java.httpclient@9-internal/Stream.java:168) at java.net.http.Exchange.readBody(java.httpclient@9-internal/Exchange.java:132) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:155) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257)
  3. 0

    If the request includes body, when HTTP_2 client tries to access server over HTTPS, it may throw the following two exceptions: Exception in thread "main" java.io.IOException: Queue closed at sun.net.httpclient.common.Queue.take(java.httpclient@9-internal/Queue.java:113) at java.net.http.Stream.lambda$receiveData$1(java.httpclient@9-internal/Stream.java:203) at java.net.http.Stream.executeInline(java.httpclient@9-internal/Stream.java:179) at java.net.http.Stream.receiveData(java.httpclient@9-internal/Stream.java:197) at java.net.http.Stream.readBodyAsync(java.httpclient@9-internal/Stream.java:154) at java.net.http.Stream.readBody(java.httpclient@9-internal/Stream.java:168) at java.net.http.Exchange.readBody(java.httpclient@9-internal/Exchange.java:132) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:155) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257) at SimpleSslTest.test(SimpleSslTest.java:37) at SimpleSslTest.main(SimpleSslTest.java:24) Exception in thread "main" java.io.IOException: stream closed at sun.net.httpclient.common.Queue.take(java.httpclient@9-internal/Queue.java:106) at java.net.http.Stream.lambda$receiveData$1(java.httpclient@9-internal/Stream.java:203) at java.net.http.Stream.executeInline(java.httpclient@9-internal/Stream.java:179) at java.net.http.Stream.receiveData(java.httpclient@9-internal/Stream.java:197) at java.net.http.Stream.readBodyAsync(java.httpclient@9-internal/Stream.java:154) at java.net.http.Stream.readBody(java.httpclient@9-internal/Stream.java:168) at java.net.http.Exchange.readBody(java.httpclient@9-internal/Exchange.java:132) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:155) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257) at SimpleSslTest.test(SimpleSslTest.java:37) at SimpleSslTest.main(SimpleSslTest.java:24)

    JDK Bug System | 3 months ago | John Jiang
    java.io.IOException: stream closed at sun.net.httpclient.common.Queue.take(java.httpclient@9-internal/Queue.java:106) at java.net.http.Stream.lambda$receiveData$1(java.httpclient@9-internal/Stream.java:203) at java.net.http.Stream.executeInline(java.httpclient@9-internal/Stream.java:179) at java.net.http.Stream.receiveData(java.httpclient@9-internal/Stream.java:197) at java.net.http.Stream.readBodyAsync(java.httpclient@9-internal/Stream.java:154) at java.net.http.Stream.readBody(java.httpclient@9-internal/Stream.java:168) at java.net.http.Exchange.readBody(java.httpclient@9-internal/Exchange.java:132) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:155) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    public class SimpleConnectTest { public static void main(String[] args) throws Exception { String url = "..."; // This access won't return body HttpClient client = HttpClient.create().version(Version.HTTP_2).build(); HttpRequest request = client.request(new URI(url)).GET(); HttpResponse<String> response = request.response(HttpResponse.BodyHandler.asString()); System.out.println(response.statusCode()); System.out.println(response.body()); } } Exception in thread "main" java.io.IOException: Queue closed at java.net.http.Queue.take(java.httpclient@9-internal/Queue.java:113) at java.net.http.Stream.lambda$receiveData$1(java.httpclient@9-internal/Stream.java:187) at java.net.http.Stream.executeInline(java.httpclient@9-internal/Stream.java:164) at java.net.http.Stream.receiveData(java.httpclient@9-internal/Stream.java:182) at java.net.http.Stream.readBodyAsync(java.httpclient@9-internal/Stream.java:142) at java.net.http.Stream.readBody(java.httpclient@9-internal/Stream.java:155) at java.net.http.Exchange.readBody(java.httpclient@9-internal/Exchange.java:131) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:121) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:251) at SimpleConnectTest.main(SimpleConnectTest.java:13)

    JDK Bug System | 4 months ago | John Jiang
    java.io.IOException: Queue closed at java.net.http.Queue.take(java.httpclient@9-internal/Queue.java:113) at java.net.http.Stream.lambda$receiveData$1(java.httpclient@9-internal/Stream.java:187) at java.net.http.Stream.executeInline(java.httpclient@9-internal/Stream.java:164) at java.net.http.Stream.receiveData(java.httpclient@9-internal/Stream.java:182) at java.net.http.Stream.readBodyAsync(java.httpclient@9-internal/Stream.java:142) at java.net.http.Stream.readBody(java.httpclient@9-internal/Stream.java:155) at java.net.http.Exchange.readBody(java.httpclient@9-internal/Exchange.java:131) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:121) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:251)
  6. 0

    When HTTP_2 client access a HTTP/2 server over HTTPS, the below exception was thrown, Exception in thread "main" java.io.IOException: stream closed at java.net.http.Queue.putAll(java.httpclient@9-internal/Queue.java:45) at java.net.http.AsyncSSLDelegate.write(java.httpclient@9-internal/AsyncSSLDelegate.java:152) at java.net.http.AsyncSSLConnection.write(java.httpclient@9-internal/AsyncSSLConnection.java:92) at java.net.http.Http2Connection.sendConnectionPreface(java.httpclient@9-internal/Http2Connection.java:564) at java.net.http.Http2Connection.<init>(java.httpclient@9-internal/Http2Connection.java:189) at java.net.http.Http2ClientImpl.getConnectionFor(java.httpclient@9-internal/Http2ClientImpl.java:101) at java.net.http.ExchangeImpl.get(java.httpclient@9-internal/ExchangeImpl.java:86) at java.net.http.Exchange.responseImpl0(java.httpclient@9-internal/Exchange.java:179) at java.net.http.Exchange.responseImpl(java.httpclient@9-internal/Exchange.java:172) at java.net.http.Exchange.response(java.httpclient@9-internal/Exchange.java:122) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:146) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:251) at SimpleSslTest.main(SimpleSslTest.java:35)

    JDK Bug System | 4 months ago | John Jiang
    java.io.IOException: stream closed at java.net.http.Queue.putAll(java.httpclient@9-internal/Queue.java:45) at java.net.http.AsyncSSLDelegate.write(java.httpclient@9-internal/AsyncSSLDelegate.java:152) at java.net.http.AsyncSSLConnection.write(java.httpclient@9-internal/AsyncSSLConnection.java:92) at java.net.http.Http2Connection.sendConnectionPreface(java.httpclient@9-internal/Http2Connection.java:564) at java.net.http.Http2Connection.<init>(java.httpclient@9-internal/Http2Connection.java:189) at java.net.http.Http2ClientImpl.getConnectionFor(java.httpclient@9-internal/Http2ClientImpl.java:101) at java.net.http.ExchangeImpl.get(java.httpclient@9-internal/ExchangeImpl.java:86) at java.net.http.Exchange.responseImpl0(java.httpclient@9-internal/Exchange.java:179) at java.net.http.Exchange.responseImpl(java.httpclient@9-internal/Exchange.java:172) at java.net.http.Exchange.response(java.httpclient@9-internal/Exchange.java:122) at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:146) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:251)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.IOException

      Retry limit exceeded at java.net.http.MultiExchange.response(java.httpclient@9-internal/MultiExchange.java:170) at java.net.http.HttpRequestImpl.response(java.httpclient@9-internal/HttpRequestImpl.java:257)

      at SimpleRedirectTest.main()
    2. Unknown
      SimpleRedirectTest.main
      1. SimpleRedirectTest.main(SimpleRedirectTest.java:17)
      1 frame