为什么在我的PlayFramework应用程序中得到很长的超时时间? [英] Why do I get a very long timeout in my PlayFramework app?

查看:516
本文介绍了为什么在我的PlayFramework应用程序中得到很长的超时时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个工作的应用程序,但有时候当我更改内容并点击浏览器中的重新加载按钮时,应用程序将永远超时(300000ms或
5分钟! STRONG>)。之后,我在浏览器中得到以下例外:

  java.util.concurrent.TimeoutException:Futures在[300000毫秒后超时] 
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 $ (.csult (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)

控制台中的错误:

  [错误]应用程序 -  
[info]
[info ]!内部服务器错误,对于(GET)[/] - >
[info]
[info] java.util.concurrent.TimeoutException:Futures在[300000毫秒]后超时
[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:在scala-library-2.11.1.jar:na]
[info] at scala .concurrent.Await $ .result(package.scala:111)〜[scala-library-2.11.1.jar:na]

大部分时间我只是停止激活器(控制台中的CTRL + D),然后用激活程序运行重新启动,然后应用程序工作。


$ b $我已经尝试了1.3.2的激活,甚至在不同的计算机上的脱机分发,但没有用。



我正在使用Scala IDE 4.0(Eclipse)。



我也尝试过 activation〜run ,所以更改将被编译成asap。



更改超时的示例:



(我只是添加了第一行 $ document.ready(function()和结尾处的相应括号)。超时后,我停止了CTRL + D运行的激活程序,并重新启动它c $ c>激活程序运行,我没有更改任何代码!开始完成后,我的程序按照意图执行。



<$ p $($($($)$($)$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ var $ this = $(this);
$ this.css(color,orange);
var num = $('#num');
var currentNumber = num .text()。length?parseInt(num.text()):0;
num.text(currentNumber + 1);
});
});
< ; / script>

我现在很频繁地收到这些超时,就像我90%的代码更改一样是非常安



那么如何解决很长的超时?

解决方案

p>在我的第一篇文章中,我似乎已经找到了自己的答案来编辑。我写下来,这样可能有助于有人遇到类似的问题:



在激活器1.3.2中,fork in run-settting已添加。因此,激活程序UI将项目中的 fork添加到您的 build.sbt 中,运行:= true p>

只需在run:= false 中删除​​,注释或将行更改为 fork。值得一提的是,我的项目的编译现在比以前快得多。



我仍然不明白为什么超时发生,如果有更多的洞察力,我会很乐意听到它。
但现在我有一个有效的解决方法。


I have created a working app, but sometimes when I change things and hit the "Reload"-Button in my browser, the app takes forever to time out (300000ms 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)

The error in the 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]

Most of the time I simply stop the activator (CTRL+D in the console) and then restart it with 'activator run', the app works then.

I have tried it with the activator 1.3.2 and even with the offline distribution on different computers, but to no avail.

I'm using the Scala IDE 4.0 (Eclipse).

[EDIT]: I have also tried activator ~run, so changes will be compiled asap.

An example for a change that timed out:

(I simply have added the first line $document.ready(function()and the corresponding brackets at the end). After I got the timeout, I stopped the activator run by CTRL+D and re-started it by activator run. I did not change any of my code! When the start was complete, 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 now, like in 90% of my code changes which is very annoying.

So how can I fix the very long timeout?

解决方案

I seem to have found the answer myself while googling for the edit in my first post. I write this down so it might help somebody with a similar problem:

In activator 1.3.2 a "fork in run"-settting has been added. So the activator UI adds the line fork in run := true to your build.sbt in the project.

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

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

I still dont understand fully why the timeouts happen, if someone has more insight into this I would gladly hear it. But for now I have a functioning workaround.

这篇关于为什么在我的PlayFramework应用程序中得到很长的超时时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆