Courseiva
Troubleshooting and OptimizationhardMultiple ChoiceObjective-mapped

DVA-C02 Troubleshooting and Optimization Practice Question

An application running on Amazon ECS (Fargate) uses an Application Load Balancer (ALB) with connection draining enabled. The application is experiencing intermittent 502 (Bad Gateway) errors during rolling updates of the ECS service. The developer notices that the ALB is routing requests to tasks that are in the 'Draining' state. The ECS service is configured with a deployment circuit breaker that automatically rolls back a failed deployment. What is the most likely cause of the 502 errors?

⚠ Common exam trap

It's easy for candidates to assume connection draining is a silver bullet that prevents all errors during rolling updates, but they overlook that the application must handle SIGTERM to allow the draining process to work as intended.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The application is not handling the SIGTERM signal from ECS, causing it to terminate abruptly while the ALB still routes traffic to it.

When ECS sends a SIGTERM signal to a Fargate task during a rolling update, the task is expected to gracefully shut down. If the application does not handle SIGTERM, it terminates immediately, but the ALB may still have the task registered as a target and continue routing requests to it. Since the task is already dead or unresponsive, the ALB receives no valid HTTP response and returns a 502 Bad Gateway error. Connection draining is enabled, but it only works if the task signals the ALB that it is deregistering; without proper SIGTERM handling, the task dies before the draining process completes.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The ALB's idle timeout is too short, causing connections to be dropped before the application responds.

    Why it's wrong here

    A short ALB idle timeout causes 504 Gateway Timeout errors, not 502 Bad Gateway errors. A 504 error occurs when the load balancer does not receive a response from the registered target within the configured timeout period, indicating the application took too long to process the request. In contrast, a 502 error typically signifies that the load balancer received an invalid response from the target, or the target closed the connection prematurely, which is distinct from a simple timeout.

  • The ALB's connection draining timeout is set to 0 seconds, causing connections to be dropped immediately when deregistering targets.

    Why it's wrong here

    A connection draining timeout of 0 would immediately stop new connections to draining targets, but existing connections would still be allowed to complete. It would not cause 502 errors; it might cause 504 if connections are not completed in time. More importantly, the ALB's connection draining is separate from ECS task draining.

  • The ECS deployment circuit breaker is incorrectly configured to roll back on health check failures.

    Why it's wrong here

    The ECS deployment circuit breaker is designed to automatically roll back a deployment if it fails to meet health check criteria or if a specified percentage of tasks become unhealthy. Its function is to prevent prolonged deployment failures, not to cause 502 errors. Instead, 502 errors, often indicative of an unhealthy or abruptly terminated task, would be a symptom that could *trigger* the circuit breaker to initiate a rollback, rather than being a direct consequence of its configuration.

  • The application is not handling the SIGTERM signal from ECS, causing it to terminate abruptly while the ALB still routes traffic to it.

    Why this is correct

    When ECS stops a task, it sends a SIGTERM signal to allow the application to gracefully shut down. If the application does not catch this signal and stop accepting new connections or complete in-flight requests before exiting, the ALB may still send traffic to the task after it stops, resulting in 502 errors. This is a common issue during rolling updates.

About these practice questions

One of 724 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.