I have an akka-streams application, and there is a graph which includes a bunch of http calls. It works perfect for a while (10-20 minutes), and after some time fails with the next reason:
[LoaderActorSystem-akka.actor.default-dispatcher-54] [LoaderActorSystem/Pool(shared->https://chpp.hattrick.org:443)] [3 (WaitingForResponseEntitySubscription)]Response entity was not subscribed after 5 minutes. Make sure to read the response `entity` body or call `entity.discardBytes()` on it -- in case you deal with `HttpResponse`, use the shortcut `response.discardEntityBytes()`. GET /chppxml.ashx Empty -> 200 OK Default(18198 bytes)
As recommended here and at the documentation I've implemented parsing of the requests next way:
val httpsFlow = Http().cachedHostConnectionPoolHttps[T](URL)
val unmarshallFlow = Flow[(Try[HttpResponse], T)].mapAsync(2){
case (Success(response), t) =>
response.entity.dataBytes
.runReduce(_ ++ _)
.map(data => (data.utf8String, t))
}
.map(parse)
httpsFlow.via(unmarshallFlow).async
So, before this error my app performs thousands of http calls, I can't find the reason why the problems appear.
Subscription timeout config is 5 minutes(changed it from 10 seconds to 1 hour, it doesn't help):
akka.http.host-connection-pool.response-entity-subscription-timeout = 5.minute