playframework / playframework/play-ws
IOException Connection closed after many requests
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 224
- Forks
- 92
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 28
Description
Hello! We are using play ws to execute requests on a highly loaded system. After running the system for about 30 - 40 minutes, we get an IOException Connection closed error and all further requests stop being executed until the system is restarted. Perhaps you know this problem and you tell me what we are doing wrong?
We use -
Scala version: 2.11.6
Play version: 2.4.11
Akka version: 2.4.0
SBT version: 0.13.8
Error stack trace -
java.io.IOException: Closed
at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequest(NettyRequestSender.java:98) ~[com.ning.async-http-client-1.9.40.jar:na]
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:87) ~[com.ning.async-http-client-1.9.40.jar:na]
at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:506) ~[com.ning.async-http-client-1.9.40.jar:na]
at play.api.libs.ws.ning.NingWSClient.executeRequest(NingWS.scala:47) ~[com.typesafe.play.play-ws_2.11-2.4.11.jar:2.4.11]
at play.api.libs.ws.ning.NingWSRequest.execute(NingWS.scala:312) ~[com.typesafe.play.play-ws_2.11-2.4.11.jar:2.4.11]
at play.api.libs.ws.ning.NingWSRequest.execute(NingWS.scala:128) ~[com.typesafe.play.play-ws_2.11-2.4.11.jar:2.4.11]
at play.api.libs.ws.WSRequest$class.post(WS.scala:455) ~[com.typesafe.play.play-ws_2.11-2.4.11.jar:2.4.11]
at play.api.libs.ws.ning.NingWSRequest.post(NingWS.scala:81) ~[com.typesafe.play.play-ws_2.11-2.4.11.jar:2.4.11]
at ru.alfatell.webregistry.XmlExecutionContext$WebExecutor.callInternal(XmlExecutor.scala:338) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at ru.alfatell.webregistry.XmlExecutor$class.call(XmlExecutor.scala:199) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at ru.alfatell.webregistry.XmlExecutor$class.perform(XmlExecutor.scala:119) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at ru.alfatell.webregistry.XmlExecutionContext$WebExecutor.perform(XmlExecutor.scala:287) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at ru.alfatell.webregistry.ExternalApiGateway$$anonfun$execute$1$$anonfun$apply$12.apply(ExternalApiGateway.scala:111) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at ru.alfatell.webregistry.ExternalApiGateway$$anonfun$execute$1$$anonfun$apply$12.apply(ExternalApiGateway.scala:90) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at scala.util.Try$.apply(Try.scala:192) ~[org.scala-lang.scala-library-2.11.8.jar:na]
at ru.alfatell.webregistry.ExternalApiGateway$$anonfun$execute$1.apply(ExternalApiGateway.scala:90) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at ru.alfatell.webregistry.ExternalApiGateway$$anonfun$execute$1.apply(ExternalApiGateway.scala:89) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at scala.util.Success.flatMap(Try.scala:231) ~[org.scala-lang.scala-library-2.11.8.jar:na]
at ru.alfatell.webregistry.ExternalApiGateway$.execute(ExternalApiGateway.scala:89) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.tmp.ExtApiMain$$anonfun$xml$1$$anonfun$apply$1$$anonfun$4.apply(ExtApiMain.scala:24) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.tmp.ExtApiMain$$anonfun$xml$1$$anonfun$apply$1$$anonfun$4.apply(ExtApiMain.scala:24) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.tmp.ExtApiSecurity$class.callerAuthorize(ExtApiSecurity.scala:158) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.ExternalApi$.callerAuthorize(ExternalApi.scala:34) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.tmp.ExtApiMain$$anonfun$xml$1$$anonfun$apply$1.apply(ExtApiMain.scala:24) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.tmp.ExtApiMain$$anonfun$xml$1$$anonfun$apply$1.apply(ExtApiMain.scala:21) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.tmp.ExtApiSecurity$class.withCtx(ExtApiSecurity.scala:121) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.ExternalApi$.withCtx(ExternalApi.scala:34) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.tmp.ExtApiMain$$anonfun$xml$1.apply(ExtApiMain.scala:21) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at controllers.tmp.ExtApiMain$$anonfun$xml$1.apply(ExtApiMain.scala:20) ~[ru.alfatell.web-registry-portal-1.1.1-sans-externalized.jar:na]
at play.api.mvc.Action$.invokeBlock(Action.scala:533) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.api.mvc.Action$.invokeBlock(Action.scala:530) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:493) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:105) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:105) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:104) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:103) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at scala.Option.map(Option.scala:146) ~[org.scala-lang.scala-library-2.11.8.jar:na]
at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:103) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:96) ~[com.typesafe.play.play_2.11-2.4.11.jar:2.4.11]
at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:524) ~[com.typesafe.play.play-iteratees_2.11-2.4.11.jar:2.4.11]
at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:524) ~[com.typesafe.play.play-iteratees_2.11-2.4.11.jar:2.4.11]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:560) ~[com.typesafe.play.play-iteratees_2.11-2.4.11.jar:2.4.11]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:560) ~[com.typesafe.play.play-iteratees_2.11-2.4.11.jar:2.4.11]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:537) ~[com.typesafe.play.play-iteratees_2.11-2.4.11.jar:2.4.11]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:537) ~[com.typesafe.play.play-iteratees_2.11-2.4.11.jar:2.4.11]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[org.scala-lang.scala-library-2.11.8.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[org.scala-lang.scala-library-2.11.8.jar:na]
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:39) [com.typesafe.akka.akka-actor_2.11-2.4.0.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:399) [com.typesafe.akka.akka-actor_2.11-2.4.0.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [org.scala-lang.scala-library-2.11.8.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [org.scala-lang.scala-library-2.11.8.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [org.scala-lang.scala-library-2.11.8.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [org.scala-lang.scala-library-2.11.8.jar:na]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at play.api.libs.ws.ning.NingWSClient.executeRequest in NingWS.scala:47 and NingWSRequest.execute in NingWS.scala:312, then trace the underlying NettyRequestSender failure shown in the stack trace. Reproduce sustained requests under load and inspect client lifecycle and connection handling; done means the cause of the closed client is identified and a verified fix or workaround is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100