scala - Exceeded configured max-open-requests -
recently started build small web processing service using akka streams. it's quite simple, i'm pulling urls redis, i'm downloading urls(they images) later i'm processing images, , pushing them s3 , json redis.
i'm downloading lot of different kinds of images multiple sites, i'm getting whole bunch of errors 404, unexpected disconnect , response content-length 17951202 exceeds configured limit of 8388608, entitystreamexception: entity stream truncation , redirects. redirects i'm invoking requestwithredirects address founded in location header of response.
part responsible downloading pretty 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) } }
timeoutfuture quite simple takes future , timeout. if future takes longer timeout returns other future timeout exception. problem i'm having is: after time i'm getting error:
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'm not sure problem think have downloads not finished , stay in global pool of connections after while causing mentioned error. ideas causing problem? or how try find root of problem: tested 404 responses, , response content-length exceeds... errors, , doesn't seem troublemakers.
edit: problem timeoutfuture. i'm filling error described here https://stackoverflow.com/a/29330010/2963977 in opinion future downloading image never completes , it's taking connection pool resources.
i wonder why settings doesn't have impact in case :
akka.http.client.connecting-timeout = 1 s akka.http.client.idle-timeout = 1 s akka.http.host-connection-pool.idle-timeout = 1 s
edit2:
apparently timeouts not supported yet. here bug report https://github.com/akka/akka/issues/17732#issuecomment-112315953
Comments
Post a Comment