简体   繁体   English

ECS 代理在暂停时停止并重新启动 Docker 容器 Spring 在远程调试中启动 Java 应用程序

[英]ECS Agent stops and re-starts Docker container when paused Spring Boot Java app in remote debug

I noticed a problem, when I remote debug a SpringBoot app running in ECS docker container on EC2 instance (managed by task), if I pause for too long (say, need to research or talk to team members) - after about 10 minutes, AWS kills the container and starts it again because it is not considered alive.我注意到一个问题,当我远程调试在 EC2 实例(由任务管理)上的 ECS docker 容器中运行的 SpringBoot 应用程序时,如果我暂停太久(例如,需要研究或与团队成员交谈) - 大约 10 分钟后, AWS 杀死容器并重新启动它,因为它不被认为是活着的。

I assume that is because the breakpoint is paused on all threads.我认为这是因为断点在所有线程上都暂停了。

I don't know what race conditions I may introduce, if I were to pause only on the current thread so didn't try modifying that.我不知道我可能会引入什么竞争条件,如果我只在当前线程上暂停,所以没有尝试修改它。

Is there any recommended way to handle this situation, when needing to remote debug?当需要远程调试时,有什么推荐的方法来处理这种情况吗?

You can check ECS service event to know exactly why your task got terminated, most likely the task is considered as unhealthy .您可以检查 ECS 服务事件以确切了解您的任务被终止的原因,很可能该任务被认为是unhealthy的。 If yes, one of the below things can be done:如果是,则可以执行以下操作之一:

  1. Change the params to make it longer before it's considered as unhealthy在被认为不健康之前更改参数以使其更长
  2. Disable healthcheck, if you are using Application LB routing by Instance, this one will not allowed禁用healthcheck,如果你使用的是Application LB routing by Instance,这个是不允许的

Ideally, for debugging and development purpose, we can avoid remote debugging with AWS task by running your application in your local system.理想情况下,出于调试和开发目的,我们可以通过在本地系统中运行您的应用程序来避免使用 AWS 任务进行远程调试。 If you need any AWS infra structure to bootstrap/run your application, you can just login and retrieve access token before.如果您需要任何 AWS 基础架构来引导/运行您的应用程序,您可以先登录并检索访问令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring Boot启动时禁用日志记录系统调试(配置转储) - Disable logging system debug (configuration dump) when spring boot starts 如何在 docker 容器上运行的应用程序上打开远程调试? - How to turn on remote debug on app that run on a docker container? 如何在 Intellij 中远程调试作为 docker 容器运行的 java 应用程序 - How to Remote debug of java application running as docker container in Intellij 如何在Eclipse上调试远程部署的Spring Boot应用程序和Maven - How to debug remote deployed spring boot app & maven on eclipse 远程调试 Spring 引导应用程序 - Remote debug Spring Boot application 在 docker 中调试 spring-boot - debug spring-boot in docker Spring 引导应用程序 + H2(在内存中)不适用于 Docker 容器 - Spring Boot App + H2 (in Memory) not working with Docker Container 如何远程调试在相同容器中运行的具有相同代码库但配置文件不同的两个spring boot应用程序? - How to remote debug two spring boot applications running in the same container with the same codebase but with different profiles? 如何在 vs 代码中调试 Java maven spring-boot 应用程序? - How to debug a Java maven spring-boot app in vs code? 在Spring Boot应用程序启动后调用方法 - Call a method after Spring Boot app starts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM