I am facing issue with closed connection while using akka http client and processing response with huge file(100MB+) using Http().singleRequest()
. Akka-http version 10.2.4
I am making 2 concurrent requests to download the same file from the same host (e.g. http://ipv4.download.thinkbroadband.com/100MB.zip) but having for the processing of the response only one thread, so that response.dataBytes
from the responses are being processed consequently. The requests are HTTP/1.1
and the responses contain Connection: keep-alive
headers.
The processing of the first response is always successful, but the second one is always failing with ErrorInfo(Entity stream truncation. The HTTP parser was receiving an entity when the underlying connection was closed unexpectedly., (details omitted), )
I have tried all possible timeouts(client and host-connection-pool) to prevent the connection from being closed, but no go.
When I try to make two requests, but each request goes to a different host, then everything works fine. Both responses are being processed successfully.
Having 2 threads also fixes the problem.
The setting host-connection-pool.max-connections = 1
(default is 1024) also helps. But, I think that it is an ugly workaround.
Any ideas how to fix closed connection without workarounds?