Java – Google App Engine – 因请求截止期限超过而终止进程

huangapple go评论63阅读模式
英文:

Java - Google App engine - Process terminated because the request deadline was exceeded

问题

请求突然停止了,我不知道为什么会发生这种情况。
我正在使用Java 11。

{"@type":"type.googleapis.com/google.cloud.loadbalancing.type.LoadBalancerLogEntry", "statusDetails":"client_disconnected_before_any_response"}

这是我的App Engine配置:

false true true F4 50 8s 4s 1 1

英文:

the requests suddenly stopped and I don't know why this happen. I am using java11.

{"@type":"type.googleapis.com/google.cloud.loadbalancing.type.LoadBalancerLogEntry", "statusDetails":"client_disconnected_before_any_response"}

Java – Google App Engine – 因请求截止期限超过而终止进程

this my app engine configs

<precompilation-enabled>false</precompilation-enabled>
<sessions-enabled>true</sessions-enabled>
<threadsafe>true</threadsafe> 

<instance-class>F4</instance-class>
<automatic-scaling>
	<max-concurrent-requests>50</max-concurrent-requests>
	<max-pending-latency>8s</max-pending-latency> 
    <min-pending-latency>4s</min-pending-latency> 
	<min-instances>1</min-instances> 
	<min-idle-instances>1</min-idle-instances>
</automatic-scaling>

答案1

得分: 1

你遇到的错误意味着根据文档,客户端在负载均衡器能够回复之前断开了连接:

> client_disconnected_before_any_response - 在负载均衡器发送任何响应之前,与客户端的连接被中断。

而错误代码123是一个截止期限已过错误:

> HARD_REQUEST_TIME_LIMIT- 请求超过了截止期限,导致实例关闭。

这些已知问题可能导致此问题:

  • 高延迟,这意味着您的实例的启动代码可能太长,建议在这种情况下设置“min_idle_instances”,但请记住这可能会导致您的计费增加。
  • 并行运行多个请求,这可能会导致线程死锁并导致超时;在这种情况下,建议使用负载均衡器。

如LundinCast在这个stackoverflow 答案中还提到的:

> - 您很可能已将您的App Engine服务扩展元素设置为“自动扩展”(或者没有定义它,因为自动扩展是默认值)在app.yaml文件中。
> - 自动扩展的实例有10分钟的截止期限,如此处所述。您需要重新部署您的服务,使用更新的app.yaml文件将扩展元素设置为“手动扩展”或“基本扩展”,以允许您的任务运行最多24小时。

您还可以查看以下类似案例以获取更多信息:

如何解决“进程已终止,因为请求截止期限已过(错误代码123)”在Google API中?

Google App Engine:间歇性问题:进程已终止,因为请求截止期限已过(错误代码123)

英文:

Error you're getting means as per documentation that the client disconnected before load balancer could reply:

> client_disconnected_before_any_response - The connection to the client
> was broken before the load balancer sent any response.

And the Error code 123 is a Deadline Exceeded Error

> HARD_REQUEST_TIME_LIMIT- Request exceeded a deadline, causing the
> instance to shut down

Here are some known issues that cause this issue:

  • High latency, this means that your startup code for instances may take too long, what is recommended in this case is to set a “min_idle_instances” just remember that this might cause an increase in your billing.
  • Running multiple requests in parallel, this can cause a thread deadlock and result in timeouts; in this case it is recommend to use load balancers.

As also mentioned in this stackoverflow Answer by LundinCast

> - You've most likely set your App Engine service scaling element to "autoscaling" (or didn't define it, autoscaling being the default
> value) in the app.yaml file.
> - Instances in autoscaling have a deadline of 10min, as documented here. You'll need to re-deploy your service with an updated
> app.yaml file setting the scaling element to "manual scaling" or
> "basic scaling" to allow your tasks to run to up to 24h.

You might also check this similar cases for more information

how to solve "Process terminated because the request deadline was exceeded. (Error code 123)" in google api?

Google App Engine: Intermittent Issue: Process terminated because the request deadline was exceeded. (Error code 123)

huangapple
  • 本文由 发表于 2023年2月6日 19:29:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/75360732.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定