Why do I have a very long timeout in the application for PlayFramework?

I created a working application, but sometimes when I change things and click the "Reboot" button in my browser, the application takes forever (300000 ms or 5 minutes! ). After that, I get the following exception in the browser:

java.util.concurrent.TimeoutException: Futures timed out after [300000 milliseconds] scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219) scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223) scala.concurrent.Await$$anonfun$result$1.apply(package.scala:111) scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53) scala.concurrent.Await$.result(package.scala:111) play.forkrun.ForkRun$$anonfun$askForReload$1.apply(ForkRun.scala:123) play.forkrun.ForkRun$$anonfun$askForReload$1.apply(ForkRun.scala:121) play.runsupport.Reloader.reload(Reloader.scala:295) play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:122) play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scalscala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) scala.concurrent.forkjoin.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1361) scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) 

Error in console:

 [error] application - [info] [info] ! Internal server error, for (GET) [/] -> [info] [info] java.util.concurrent.TimeoutException: Futures timed out after [300000 milliseconds] [info] at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219) ~[scala-library-2.11.1.jar:na] [info] at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223) ~[scala-library-2.11.1.jar:na] [info] at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:111) ~[scala-library-2.11.1.jar:na] [info] at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53) ~[scala-library-2.11.1.jar:na] [info] at scala.concurrent.Await$.result(package.scala:111) ~[scala-library-2.11.1.jar:na] 

In most cases, I just stop the activator (CTRL + D in the console), and then restart it using the “start activator”, the application works then.

I tried it with activator 1.3.2 and even with a standalone distribution on different computers, but to no avail.

I am using Scala IDE 4.0 (Eclipse).

[EDIT]: I also tried activator ~run , so the changes will be compiled as soon as possible.

Example for timeout:

(I just added the first line of $document.ready(function() and the corresponding brackets at the end.) After I got a timeout, I stopped the activator launched by CTRL + D and restarted it with activator run . I didn't change either one of my code! When the beginning was completed, my program functioned as intended.

  <script> $(document).ready(function() { $('#icon').click(function() { var $this = $(this); $this.css("color","orange"); var num = $('#num'); var currentNumber = num.text().length ? parseInt(num.text()) : 0; num.text(currentNumber + 1); }); }); </script> 

I get these timeouts very often, for example, in 90% of my code changes, which is very annoying.

So how can I fix a very long timeout?

+2
source share
1 answer

It seems I found the answer myself while searching in the editor in my first post. I am writing this so that it helps someone with a similar problem:

In activator 1.3.2, the "fork in run" -settting command has been added. Thus, the activator user interface adds the line fork in run := true to your build.sbt in the project.

Just delete, comment out or change the line to fork in run := false . This fixed my timeouts.

Worth mentioning: compiling my project is now much faster than before.

I still don’t understand why timeouts happen, if someone has a deeper understanding of this, I would love to hear it. But at the moment I have a workaround.

+3
source

Source: https://habr.com/ru/post/1234896/


All Articles