Hello guys I have problems with using akka-http in my application. I have a
function that is downloading images from multiple sources which looks
pretty much like this:
override lazy val http: HttpExt = Http()
def requestWithRedirects(request: HttpRequest, retries: Int = 10)(implicit
akkaSystem: ActorSystem, materializer: FlowMaterializer): Future[HttpResponse]
= {
TimeoutFuture(timeout, msg = "Download timed out!") {
http.singleRequest(request)
}.flatMap {
response => handleResponse(request, response, retries)
}.recoverWith {
case e: Exception if retries > 0 =>
requestWithRedirects(request, retries = retries - 1)
}
}
My TimeoutFuture is working like described
here:
http://stackoverflow.com/questions/29318411/handle-timeout-of-response-in-akka-http/29330010#29330010
And the actual problem is an error I'm getting after some time app is
working:
Message: RuntimeException: Exceeded configured max-open-requests value of [128]
akka.http.impl.engine.client.PoolInterfaceActor$$anonfun$receive$1.applyOrElse
in PoolInterfaceActor.scala::109
akka.actor.Actor$class.aroundReceive in Actor.scala::467
akka.http.impl.engine.client.PoolInterfaceActor.akka$stream$actor$ActorSubscriber$$super$aroundReceive
in PoolInterfaceActor.scala::46
akka.stream.actor.ActorSubscriber$class.aroundReceive in
ActorSubscriber.scala::208
akka.http.impl.engine.client.PoolInterfaceActor.akka$stream$actor$ActorPublisher$$super$aroundReceive
in PoolInterfaceActor.scala::46
akka.stream.actor.ActorPublisher$class.aroundReceive in
ActorPublisher.scala::317
akka.http.impl.engine.client.PoolInterfaceActor.aroundReceive in
PoolInterfaceActor.scala::46
akka.actor.ActorCell.receiveMessage in ActorCell.scala::516
akka.actor.ActorCell.invoke in ActorCell.scala::487
akka.dispatch.Mailbox.processMailbox in Mailbox.scala::238
akka.dispatch.Mailbox.run in Mailbox.scala::220
akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec in
AbstractDispatcher.scala::397
scala.concurrent.forkjoin.ForkJoinTask.doExec in ForkJoinTask.java::260
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask in
ForkJoinPool.java::1339
scala.concurrent.forkjoin.ForkJoinPool.runWorker in ForkJoinPool.java::1979
scala.concurrent.forkjoin.ForkJoinWorkerThread.run in
ForkJoinWorkerThread.java::107
I think my problem is caused by connections that hangs and never returns
and those are slowly taking may pool resources and after a while are
causing mentioned error. What is puzzling me the most is why settings
akka.http.client.connecting-timeout = 1 s
akka.http.client.idle-timeout = 1 s
akka.http.host-connection-pool.idle-timeout = 1 s
doesn't force
http.singleRequest(request)
to terminate.
Any ideas how to fix/walk around this issue?
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.