Spring Boot: 在成功部署后的Heroku错误

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

Spring Boot : Heroku errors after successful deployment

问题

我已阅读您提供的内容。以下是翻译好的部分:

"2020-08-05T08:03:50.144941+00:00 app[web.1]: 2020-08-05 08:03:50.144 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'"

  • "初始化 ExecutorService 'applicationTaskExecutor'"

"2020-08-05T08:03:50.458342+00:00 app[web.1]: 2020-08-05 08:03:50.458 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''"

  • "Tomcat 在端口 8080(http)上启动,上下文路径为空"

"2020-08-05T08:03:50.471638+00:00 app[web.1]: 2020-08-05 08:03:50.471 INFO 4 --- [ main] c.e.P.MyWebWebsiteApplication : Started MyWebWebsiteApplication in 2.688 seconds (JVM running for 3.226)"

  • "MyWebWebsiteApplication 启动于 2.688 秒内(JVM 运行了 3.226 秒)"

"2020-08-05T08:04:53.993643+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=myweb01.herokuapp.com request_id=0fb69db1-5c01-412e-b01f-451a8a2b7ad8 fwd="86.124.21.129" dyno= connect= service= status=503 bytes= protocol=https"

  • "2020-08-05T08:04:53.993643+00:00 heroku[router]: 错误代码 H20,描述为“应用启动超时”,请求方法为 GET,路径为“/”,主机为 myweb01.herokuapp.com"

"2020-08-05T08:05:16.255402+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch"

  • "错误 R10(启动超时)-> Web 进程在启动后的 90 秒内未能绑定到 $PORT"

"2020-08-05T08:05:16.271979+00:00 heroku[web.1]: Stopping process with SIGKILL"

  • "使用 SIGKILL 停止进程"

"2020-08-05T08:05:16.349020+00:00 heroku[web.1]: Process exited with status 137"

  • "进程以状态 137 退出"

"2020-08-05T08:05:16.389343+00:00 heroku[web.1]: State changed from starting to crashed"

  • "状态从启动中变为崩溃"

"2020-08-05T08:05:16.392175+00:00 heroku[web.1]: State changed from crashed to starting"

  • "状态从崩溃变为启动中"

"2020-08-05T08:05:23.662195+00:00 heroku[web.1]: Starting process with command java $JAVA_OPTS -jar target/MyWebWebsite-0.0.1-SNAPSHOT.jar -Dserver.port=25487 $JAR_OPTS"

  • "正在使用命令启动进程:java $JAVA_OPTS -jar target/MyWebWebsite-0.0.1-SNAPSHOT.jar -Dserver.port=25487 $JAR_OPTS"

"2020-08-05T08:05:25.791836+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them."

  • "根据 dyno 大小设置 JAVA_TOOL_OPTIONS 的默认值。自定义设置将覆盖它们。"

"2020-08-05T08:05:25.796964+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8"

  • "已选用 JAVA_TOOL_OPTIONS:-Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8"

"reading the logs and finding this here Tomcat started on port(s): 8080 i suppose could be an issue? i mean tomcat is trying to start on localhost port instead of heroku port?If this is the case how can i fix it? if this is not the case , what could be the issue ?"

  • "阅读日志并发现此处 Tomcat started on port(s): 8080,我想这可能是一个问题?我的意思是 Tomcat 正试图在本地端口而不是 Heroku 端口上启动?如果是这种情况,我该如何修复它?如果不是这种情况,可能是什么问题?"
英文:

I am struggling with this issue for a couple of days and couldn't find anything on SO and the description of error codes on heroku is to vague for me to figure out anything.I have created a basic app with no db integration, with spring framework , thymeleaf and spring mail.I have no spring security.After successfully deploying it to heroku i try to start the application server and this is what i get in the heroku logs.The app works fine on localhost with no issue.

2020-08-05T08:03:50.144941+00:00 app[web.1]: 2020-08-05 08:03:50.144  INFO 4 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-08-05T08:03:50.458342+00:00 app[web.1]: 2020-08-05 08:03:50.458  INFO 4 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-08-05T08:03:50.471638+00:00 app[web.1]: 2020-08-05 08:03:50.471  INFO 4 --- [           main] c.e.P.MyWebWebsiteApplication        : Started MyWebWebsiteApplication in 2.688 seconds (JVM running for 3.226)
2020-08-05T08:04:53.993643+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=myweb01.herokuapp.com request_id=0fb69db1-5c01-412e-b01f-451a8a2b7ad8 fwd="86.124.21.129" dyno= connect= service= status=503 bytes= protocol=https
2020-08-05T08:05:16.255402+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2020-08-05T08:05:16.271979+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-08-05T08:05:16.349020+00:00 heroku[web.1]: Process exited with status 137
2020-08-05T08:05:16.389343+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-05T08:05:16.392175+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-05T08:05:23.662195+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/MyWebWebsite-0.0.1-SNAPSHOT.jar -Dserver.port=25487 $JAR_OPTS`
2020-08-05T08:05:25.791836+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2020-08-05T08:05:25.796964+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 

This is my procfile:

web: java $JAVA_OPTS -jar target/MyWebWebsite-0.0.1-SNAPSHOT.jar -Dserver.port=$PORT $JAR_OPTS

reading the logs and finding this here Tomcat started on port(s): 8080 i suppose could be an issue? i mean tomcat is trying to start on localhost port instead of heroku port?If this is the case how can i fix it? if this is not the case , what could be the issue ?

答案1

得分: 1

这里的文档中,错误代码H20的含义是:

路由器将在等待启动进程达到“启动”状态的过程中将请求排队等待75秒。如果在75秒后没有Web dyno达到“启动”状态,路由器将记录H20并提供标准错误页面。

如果您的应用程序需要更多时间来启动,您可以使用启动超时工具来增加限制。然而,一般情况下,启动时间较长会使部署应用程序变得更加困难,并且会使从dyno故障中恢复的速度变得更慢,因此这应该被视为一种临时解决方案。

英文:

From the docs here error code H20 means

> The router will enqueue requests for 75 seconds while waiting for
> starting processes to reach an “up” state. If after 75 seconds, no web
> dynos have reached an “up” state, the router logs H20 and serves a
> standard error page

If your application requires more time to boot, you may use the boot timeout tool to increase the limit. However, in general, slow boot times will make it harder to deploy your application and will make recovery from dyno failures slower, so this should be considered a temporary solution

答案2

得分: 0

尝试将引导超时设置为120秒 - 一些SpringBoot应用程序需要一些时间来引导。可以按照这里所示的方式执行请求:https://devcenter.heroku.com/changelog-items/364

另外,健康检查过程基于HTTP请求,因此请确保您的应用程序通过常规的Web端口(80、8080、443)提供服务。

英文:

Try to set boot timeout to 120 seconds - some SpringBoot apps take some time to boot. The request can be done as shown here: https://devcenter.heroku.com/changelog-items/364

Also, the health check process is based on HTTP requests, so be sure that your app is served through normal Web ports (80, 8080, 443).

huangapple
  • 本文由 发表于 2020年8月5日 16:10:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/63260962.html
匿名

发表评论

匿名网友

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

确定