akka.pattern.AskTimeoutException 而 运行 Lagom HelloWorld 示例
akka.pattern.AskTimeoutException while running Lagom HelloWorld example
我在尝试解释 Hello World 示例时遇到问题 here。
请注意,我刚刚修改了 HelloEntity.java
文件,以便能够 return 除 "Hello, World!" 之外的内容。最确定的是我的更改需要时间,因此我收到以下超时错误。
我目前正在尝试(做一个 PoC)在单个节点上以了解 Lagom 框架并且没有自由部署多个节点。
我也尝试修改 application.conf "call-timeout = 100s" 中的默认 lagom.circuit-breaker 但是,这似乎没有帮助。
以下是准确的错误信息供您参考:
{"name":"akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://hello-impl-application/system/sharding/HelloEntity#1074448247]] after [5000 ms]. Sender[null] sent message of type \"com.lightbend.lagom.javadsl.persistence.CommandEnvelope\".","detail":"akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://hello-impl-application/system/sharding/HelloEntity#1074448247]] after [5000 ms]. Sender[null] sent message of type \"com.lightbend.lagom.javadsl.persistence.CommandEnvelope\".\n\tat akka.pattern.PromiseActorRef$.$anonfun$defaultOnTimeout(AskSupport.scala:595)\n\tat akka.pattern.PromiseActorRef$.$anonfun$apply(AskSupport.scala:605)\n\tat akka.actor.Scheduler$$anon.run(Scheduler.scala:140)\n\tat scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:866)\n\tat scala.concurrent.BatchingExecutor.execute(BatchingExecutor.scala:109)\n\tat scala.concurrent.BatchingExecutor.execute$(BatchingExecutor.scala:103)\n\tat scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:864)\n\tat akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(LightArrayRevolverScheduler.scala:328)\n\tat akka.actor.LightArrayRevolverScheduler$$anon.executeBucket(LightArrayRevolverScheduler.scala:279)\n\tat akka.actor.LightArrayRevolverScheduler$$anon.nextTick(LightArrayRevolverScheduler.scala:283)\n\tat akka.actor.LightArrayRevolverScheduler$$anon.run(LightArrayRevolverScheduler.scala:235)\n\tat java.lang.Thread.run(Thread.java:748)\n"}
问题:有没有办法通过修改 Hello World 项目中的 application.conf 或任何 java 源文件来增加 akka 超时?你能帮我提供确切的细节吗?
预先感谢您的时间和帮助。
调用超时时间为断路器的超时时间,使用lagom.circuit-breaker.default.call-timeout
配置。但这不是上面的超时,上面的超时是对您的 HelloEntity
的请求,该超时是使用 lagom.persistence.ask-timeout
配置的。对实体的请求超时的原因是因为在 multi-node 环境中,您的实体跨节点分片,因此对它们的询问可能会转到另一个节点,这就是为什么在该节点的情况下需要超时的原因没有响应。
综上所述,我认为更改 ask-timeout
不会解决您的问题。如果您只有一个节点,那么如果一切正常,您的实体应该立即响应。
- 这是您在日志中看到的唯一错误吗?
- 您是在 devmode 中看到这个(即,使用
runAll
命令),还是您以其他方式 运行 Lagom 服务?
- 您的数据库有响应吗?
感谢詹姆斯 help/pointer。
将以下行添加到 resources/application.conf 对我有用:
lagom.persistence.ask-timeout=30s
hello {
..
..
call-timeout = 30s
call-timeout = ${?CIRCUIT_BREAKER_CALL_TIMEOUT}
..
}
一个Call
是一个Service-to-Service通信。这是一个与远程服务器通信的 SeviceClient。它使用断路器。这是一个 extra-service 调用。
ask
(在 lagom.persistence 的上下文中)正在向持久实体发送命令。这发生在你的 Lagom 服务的节点上。它没有使用断路器。这是一个 intra-service 电话。
我在尝试解释 Hello World 示例时遇到问题 here。
请注意,我刚刚修改了 HelloEntity.java
文件,以便能够 return 除 "Hello, World!" 之外的内容。最确定的是我的更改需要时间,因此我收到以下超时错误。
我目前正在尝试(做一个 PoC)在单个节点上以了解 Lagom 框架并且没有自由部署多个节点。
我也尝试修改 application.conf "call-timeout = 100s" 中的默认 lagom.circuit-breaker 但是,这似乎没有帮助。
以下是准确的错误信息供您参考:
{"name":"akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://hello-impl-application/system/sharding/HelloEntity#1074448247]] after [5000 ms]. Sender[null] sent message of type \"com.lightbend.lagom.javadsl.persistence.CommandEnvelope\".","detail":"akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://hello-impl-application/system/sharding/HelloEntity#1074448247]] after [5000 ms]. Sender[null] sent message of type \"com.lightbend.lagom.javadsl.persistence.CommandEnvelope\".\n\tat akka.pattern.PromiseActorRef$.$anonfun$defaultOnTimeout(AskSupport.scala:595)\n\tat akka.pattern.PromiseActorRef$.$anonfun$apply(AskSupport.scala:605)\n\tat akka.actor.Scheduler$$anon.run(Scheduler.scala:140)\n\tat scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:866)\n\tat scala.concurrent.BatchingExecutor.execute(BatchingExecutor.scala:109)\n\tat scala.concurrent.BatchingExecutor.execute$(BatchingExecutor.scala:103)\n\tat scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:864)\n\tat akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(LightArrayRevolverScheduler.scala:328)\n\tat akka.actor.LightArrayRevolverScheduler$$anon.executeBucket(LightArrayRevolverScheduler.scala:279)\n\tat akka.actor.LightArrayRevolverScheduler$$anon.nextTick(LightArrayRevolverScheduler.scala:283)\n\tat akka.actor.LightArrayRevolverScheduler$$anon.run(LightArrayRevolverScheduler.scala:235)\n\tat java.lang.Thread.run(Thread.java:748)\n"}
问题:有没有办法通过修改 Hello World 项目中的 application.conf 或任何 java 源文件来增加 akka 超时?你能帮我提供确切的细节吗? 预先感谢您的时间和帮助。
调用超时时间为断路器的超时时间,使用lagom.circuit-breaker.default.call-timeout
配置。但这不是上面的超时,上面的超时是对您的 HelloEntity
的请求,该超时是使用 lagom.persistence.ask-timeout
配置的。对实体的请求超时的原因是因为在 multi-node 环境中,您的实体跨节点分片,因此对它们的询问可能会转到另一个节点,这就是为什么在该节点的情况下需要超时的原因没有响应。
综上所述,我认为更改 ask-timeout
不会解决您的问题。如果您只有一个节点,那么如果一切正常,您的实体应该立即响应。
- 这是您在日志中看到的唯一错误吗?
- 您是在 devmode 中看到这个(即,使用
runAll
命令),还是您以其他方式 运行 Lagom 服务? - 您的数据库有响应吗?
感谢詹姆斯 help/pointer。 将以下行添加到 resources/application.conf 对我有用:
lagom.persistence.ask-timeout=30s
hello {
..
..
call-timeout = 30s
call-timeout = ${?CIRCUIT_BREAKER_CALL_TIMEOUT}
..
}
一个Call
是一个Service-to-Service通信。这是一个与远程服务器通信的 SeviceClient。它使用断路器。这是一个 extra-service 调用。
ask
(在 lagom.persistence 的上下文中)正在向持久实体发送命令。这发生在你的 Lagom 服务的节点上。它没有使用断路器。这是一个 intra-service 电话。