Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
5.1.3
-
None
-
None
Description
Apache httpclient 5.1.3 not sending POST data on retry via DefaultHttpRequestRetryStrategy
I didn't set any retry strategy for CloseableHttpAsyncClient, so use default retry strategy DefaultHttpRequestRetryStrategy、
I am making a POST call to the server with JSON payload in SimpleHttpRequest.
I call the execute method like public final Future<SimpleHttpResponse> execute(final SimpleHttpRequest request,final FutureCallback<SimpleHttpResponse> callback)
When server returns with "429 Too Many Requests" the retry strategy kicks in and makes another retry request .
I have enabled the logs and what I observe is, in the first request the JSON payload is sent properly. But on the retry request no payload is sent to the server and I am receiving a "400 Bad Request".
Through the tracking code, the reasons are found as follows:
Eventually a SimpleRequestProducer.create(request) will be created that contains a dataProducer and the dataProducer has the requested body, and BasicAsyncEntityProducer.isRepeatable return true
The first request will call org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer#produce to launch the body
When initiating a retry request, calling org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer#produce again the body will not be sent again, because bytebuf.hasRemaining() returns false
This looks like a problem
BasicAsyncEntityProducer isRepeatable but the produce method cannot be called repeatedly
thanks
Attachments
Issue Links
- Blocked
-
HTTPCLIENT-2194 Async retries not including body
- Resolved