关闭ExecutorService'applicationTaskExecutor' [英] Shutting down ExecutorService 'applicationTaskExecutor'

查看:1055
本文介绍了关闭ExecutorService'applicationTaskExecutor'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在AWS ECS集群中的docker容器中部署了一个Spring-boot应用程序.

I have a Spring-boot application deployed in docker container within in AWS ECS cluster.

我的应用程序堆栈=> Spring Boot-JPA-MySQL RDS

My application stack is => Spring Boot -- JPA -- MySQL RDS

最初部署了应用程序,并可以通过EC2公共IP对其进行访问.

Initially application is deployed and accessible through EC2 public IP.

但是几分钟后,只有应用程序正在关闭ExecutorService'applicationTaskExecutor'并再次重新启动容器.每3/4分钟就不断发生一次.

But after few minutes only application is Shutting down ExecutorService 'applicationTaskExecutor' and restart container again. it is happening constantly in every 3/4 mins.

在连接到相同RDS的本地部署中没有出现这种错误.

I am not getting this kind of error in local deployment connecting to same RDS.

这是我的application.properties

Here is my application.properties

server.port=8192

spring.datasource.url=jdbc:mysql://multichannelappdatabase.cvjsdfsdfsdfsfs.us-east-1.rds.amazonaws.com:3306/multichannelappdb
spring.datasource.username=xxxxx
spring.datasource.password=xxxxx
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver


spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false

spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.show-sql=true
#spring.jpa.hibernate.ddl-auto=create
spring.datasource.testWhileIdle = true
spring.datasource.timeBetweenEvictionRunsMillis = 10000
spring.datasource.tomcat.testOnBorrow=true 
spring.datasource.tomcat.validationQuery=SELECT 1

这是我的cloudwatch日志

and here is my cloudwatch log


16:20:50
2019-05-02 16:20:50.514 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8192 (http) with context path ''

16:20:50
2019-05-02 16:20:50.516 INFO 1 --- [ main] c.api.app.runner.UserManagerApplication : Started UserManagerApplication in 9.338 seconds (JVM running for 10.291)

16:20:57
2019-05-02 16:20:57.117 INFO 1 --- [nio-8192-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'

16:20:57
2019-05-02 16:20:57.117 INFO 1 --- [nio-8192-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'

16:20:57
2019-05-02 16:20:57.131 INFO 1 --- [nio-8192-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 14 ms

16:23:19
2019-05-02 16:23:19.253 INFO 1 --- [ Thread-4] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'

16:23:19
2019-05-02 16:23:19.254 INFO 1 --- [ Thread-4] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

16:23:19
2019-05-02 16:23:19.257 INFO 1 --- [ Thread-4] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...

16:23:19
2019-05-02 16:23:19.274 INFO 1 --- [ Thread-4] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.

需要解决此问题的建议.

Need suggestion to resolve this issue.

仍然遇到相同的问题..任何解决方案都会有所帮助

Still getting the same issue .. any solution will be helpful

推荐答案

可能您的健康检查未正确设置.AWS会定期尝试在特定端点上访问您的应用程序.如果无法访问此端口/路径或答复错误,AWS将重新启动容器.

Probably your health-checks are not setup correctly. AWS is regularly trying to reach your application on a endpoint certain . If this port/path is not reachable or replies with an error, AWS will restart the container.

找到您的负载均衡器(即使您使用ECS,它也位于EC2仪表板上).

Find your Load-Balancer (even if you use ECS it's on the EC2 Dashboard).

  • 在实例"下,您将找到标记为不健康的容器实例.
  • 在运行状况检查"下,您可以编辑运行状况检查以与正确的端口/网址对话.确保它在您的容器上可以访问(如果是http,则对于普通请求应以200应答).

这篇关于关闭ExecutorService'applicationTaskExecutor'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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