Bobcares

Troubleshoot ECS tasks that take long to stop

by | Sep 2, 2021

Wondering how to troubleshoot ECS tasks that take long to stop? We can help you.

Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.

Today, let us discuss how we can do this.

How to troubleshoot ECS tasks that take long to stop?

Your tasks can stuck in the RUNNING state or take a longer time to move to the STOPPED state due to issues with configuration parameters or tasks.

To troubleshoot these issues, consider the following options:

  • Firstly, confirm that your DeploymentConfiguration parameters are set correctly
  • Confirm that the deregistration delay value is set correctly
  • Confirm that the ECS_CONTAINER_STOP_TIMEOUT value is set correctly
  • Look for other task-related issues

Confirm that your DeploymentConfiguration parameters are set correctly

1. Firstly, open the Amazon ECS console.
2. In the navigation pane, choose Clusters, and then choose the cluster where your container instance is draining.
3. Then, choose the ECS Instances tab, and then choose DRAINING in the Status section.
4. Next choose your container instance, and then find out the service for the tasks that are draining or taking a long time to drain.
5. Choose the Services tab, select the service, and then choose Deployments.
6. Finally, check the values for minimumHealthyPercent and maximumPercent.

Confirm that the deregistration delay value is set correctly

1. Firstly, open the Amazon ECS console.
2. In the navigation pane, choose Clusters, and then choose the cluster where your container instance is draining.
3. Choose the Services tab, and then select the service with the stack stuck in RUNNING.
4. Then, choose Target Group Name.
5. On the Details tab, scroll down, and then select the Deregistration delay check box.

Confirm that the ECS_CONTAINER_STOP_TIMEOUT value is set correctly

1. Firstly, connect to your container instance using SSH.
2. Run the docker inspect ecs-agent –format ‘{{json .Config.Env}}’ command.
3. Check if there is a value for ECS_CONTAINER_STOP_TIMEOUT.

Look for other task-related issues

1. Firstly, connect to your container instance using SSH.
2. Verify that the Docker daemon and Amazon ECS container agent are running for either your Amazon Linux 1 AMIs or Amazon Linux 2 AMIs.
3. Finally, check the application logs based on the log driver set by logConfiguration.

[Need help with ECS? We’d be happy to assist you]

Conclusion

In short, we saw how our Support Techs troubleshoot ECS tasks that take long to stop.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.