Play Framework Hanging when hitting app in browser

时间:2015-10-30 22:14:02

标签: java playframework-2.0 hang

I am running an app in Play using activator run, and maybe 3 out of 5 times, it will just hang, when I go to http://localhost:9000/, it just sits there spinning forever.

I'm seeing a lot of promise timed out errors also.

Where should I look for this issue?

I turned up logging with logLevel := Level.Debug, but I see nothing amiss. While the app is spinning, I see no logging at all.


If I just let it sit and spin for a long time (~5 min) it will eventually give this error:

[info] play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[PrivilegedActionException: null]]
[info]  at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:265) ~[play_2.11-2.4.3.jar:2.4.3]
[info]  at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:191) ~[play_2.11-2.4.3.jar:2.4.3]
[info]  at play.core.server.Server$class.logExceptionAndGetResult$1(Server.scala:50) [play-server_2.11-2.4.3.jar:2.4.3]
[info]  at play.core.server.Server$$anonfun$getHandlerFor$4.apply(Server.scala:59) [play-server_2.11-2.4.3.jar:2.4.3]
[info]  at play.core.server.Server$$anonfun$getHandlerFor$4.apply(Server.scala:57) [play-server_2.11-2.4.3.jar:2.4.3]
[info]  at scala.util.Either$RightProjection.flatMap(Either.scala:522) [scala-library.jar:na]
[info]  at play.core.server.Server$class.getHandlerFor(Server.scala:57) [play-server_2.11-2.4.3.jar:2.4.3]
[info]  at play.core.server.NettyServer.getHandlerFor(NettyServer.scala:33) [play-netty-server_2.11-2.4.3.jar:2.4.3]
[info]  at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$8.apply(PlayDefaultUpstreamHandler.scala:139) [play-netty-server_2.11-2.4.3.jar:2.4.3]
[info]  at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$8.apply(PlayDefaultUpstreamHandler.scala:139) [play-netty-server_2.11-2.4.3.jar:2.4.3]
[info] Caused by: java.security.PrivilegedActionException: null
[info]  at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_20]
[info]  at play.runsupport.Reloader$.play$runsupport$Reloader$$withReloaderContextClassLoader(Reloader.scala:39) ~[na:na]
[info]  at play.runsupport.Reloader.reload(Reloader.scala:321) ~[na:na]
[info]  at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:113) ~[play-server_2.11-2.4.3.jar:2.4.3]
[info]  at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:111) ~[play-server_2.11-2.4.3.jar:2.4.3]
[info]  at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library.jar:na]
[info]  at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library.jar:na]
[info]  at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423) ~[na:1.8.0_20]
[info]  at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[na:1.8.0_20]
[info]  at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:902) ~[na:1.8.0_20]
[info] Caused by: java.util.concurrent.TimeoutException: Futures timed out after [300000 milliseconds]
[info]  at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219) ~[scala-library.jar:na]
[info]  at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223) ~[scala-library.jar:na]
[info]  at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190) ~[scala-library.jar:na]
[info]  at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53) ~[scala-library.jar:na]
[info]  at scala.concurrent.Await$.result(package.scala:190) ~[scala-library.jar:na]
[info]  at play.forkrun.ForkRun$$anonfun$askForReload$1.apply(ForkRun.scala:127) ~[na:na]
[info]  at play.forkrun.ForkRun$$anonfun$askForReload$1.apply(ForkRun.scala:125) ~[na:na]
[info]  at play.runsupport.Reloader$$anonfun$reload$1.apply(Reloader.scala:323) ~[na:na]
[info]  at play.runsupport.Reloader$$anon$3.run(Reloader.scala:43) ~[na:na]
[info]  at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_20]

I should mention that this is a very simple app. It is doing nothing but rendering some HTML so far.


Its too bad, because it seems like there is a lot of good in the framework, but it is just slow and terribly unreliable.

1 个答案:

答案 0 :(得分:2)

从Activators UI(用于产生进程)启动应用程序时总是添加

fork in run := true,因此停止使用给定应用程序的UI(可能在IDE中添加启动配置)或始终记得清除/注释/设置为false 。