-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
Environment
- aiohttp version: 3.12.11+ (specifically tested with 3.12.13)
- Python version: 3.9
- Platform: AWS Lambda (Python runtime)
- Related dependencies: aiodns (latest), pycares (latest), aiosignal (latest)
Problem Description
Intermittent connection failures occurring after Lambda functions run for extended periods under high load, presenting with the misleading error message:
ClientConnectorError: Cannot connect to host api.xxxxx.com:443 ssl:default cannot contact to DNS server
Root Cause Analysis
The change in aiohttp 3.12.11+ where ssl_shutdown_timeout default value changed from 0.1 to 0 causes aggressive connection closure without proper SSL shutdown handshake.
Technical Mechanism
- Connection Creation: Lambda instance establishes HTTPS connections normally
- Aggressive Closure: ssl_shutdown_timeout=0 causes immediate TCP RST instead of graceful SSL shutdown
- State Inconsistency: DNS cache retains valid entries while connection pool references become stale
- Subsequent Failures: New Lambda instances attempt to use cached DNS data with inconsistent connection states
- SSL Handshake Failure: Server-side detects previous connection anomalies during new SSL handshake
- Error Misreporting: SSL handshake failures get incorrectly reported as DNS contact failures
This Represents a Significant Breaking Change
We believe the ssl_shutdown_timeout default value change from 0.1 to 0 in version 3.12.11+ constitutes a significant breaking change that warrants more prominent documentation and community awareness.
To Reproduce
TBD
Expected behavior
The application should continue to function as expected after upgrading aiohttp, aiodns, aiosignal, and pycares to their latest versions.
Logs/tracebacks
ClientConnectorError: Cannot connect to host api.xxxxx.com:443 ssl:default cannot contact to DNS server
Python Version
$ python 3.9
aiohttp Version
aiohttp version: 3.12.11+ (specifically tested with 3.12.13)
multidict Version
$ python -m pip show multidict
propcache Version
$ python -m pip show propcache
yarl Version
$ python -m pip show yarl
OS
AWS Lambda (Python runtime)
Related component
Client
Additional context
While we understand that the ssl_shutdown_timeout change may have been intended as an optimization, its impact in production environments qualifies it as a breaking change that deserves prominent documentation. This would help the community avoid the costly debugging and production issues we experienced.
Code of Conduct
- I agree to follow the aio-libs Code of Conduct