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 | 9 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  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 | 9 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)

    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