AWS Lambda functions are ephemeral, event-driven compute services that frequently interact with external systems including other AWS services via
boto3, external APIs through HTTP requests, databases, and message brokers. When these network calls are made without explicit timeout parameters, the
Lambda function becomes vulnerable to indefinite hanging if the remote service becomes unresponsive due to network issues, service overload, or
connectivity problems. Unlike traditional server environments where hanging requests might affect only a single user session, Lambda functions that
hang continue to consume billable compute time until the function’s maximum execution timeout is reached, which can be up to 15 minutes. This creates
a cascading effect where network reliability issues directly translate to increased operational costs and unpredictable system behavior.
What is the potential impact?
Hanging executions lead to increased AWS costs due to wasted compute time while waiting for unresponsive services. The lack of explicit timeouts
causes unpredictable failure behavior, making it difficult to distinguish between functional errors and network stalls, which complicates debugging
and monitoring. When the Lambda function’s maximum timeout is reached, the execution is abruptly terminated, preventing graceful error handling,
proper logging, and cleanup operations. In connection pooling scenarios, hanging requests can exhaust available connections, and the unpredictable
delays can cause cascading failures in upstream services that depend on the Lambda function’s response.