Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-2114

AsyncHttpRequestRetryExec ignores HttpRequestRetryStrategy

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.0.1
    • 5.2-alpha1
    • HttpClient (async)
    • None

    Description

      It is noted in the Javadoc that AsyncHttpRequestRetryExec does not respect HttpRequestRetryStrategy.getRetryInterval()

      Instead, the request is retried instantly. The immediate retry happens for both IOException retries and server responses with 429 and 503 status codes. The Retry-After header is also ignored due to this issue. Retrying instantly is not desirable, especially and can actively make the situation worse.

      The most relevant code block is in the completed() method of the AsyncExecCallback that is created. If the request is meant to be retried, AsyncHttpRequestRetryExec immediately calls the internalExecute() method to retry the request.

      A naive approach would be to add to the internal State class a field for a TimeValue representing the delay for the request. In handleResponse(), the response from  retryStrategy.retryRequest() could be stored in the state object and then in completed(), you could call TimeValue.sleep() on that property. However, I imagine this has the potential to lock up resources for a significant amount of time.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dev-warner Lily Warner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: