aws
runtime_error
ai_generated
partial
RDS 代理连接已终止:事务空闲超时(60 秒)
RDS Proxy connection terminated: idle in transaction timeout (60 seconds)
ID: aws/rds-proxy-idle-connection-timeout
80%修复率
85%置信度
1证据数
2024-06-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| RDS Proxy 1.0 | active | — | — | — |
| aurora-mysql-8.0 | active | — | — | — |
| postgresql-15.4 | active | — | — | — |
根因分析
RDS 代理默认强制执行 60 秒事务空闲超时,终止持有打开事务但无活动的连接。
English
RDS Proxy enforces a 60-second idle transaction timeout by default, terminating connections that hold open transactions without activity.
官方文档
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html#rds-proxy-idle-timeout解决方案
-
在数据库中设置更高的 `idle_in_transaction_session_timeout` 值(例如 `SET idle_in_transaction_session_timeout = '120000';`)以允许更长的空闲事务。
-
实现应用层保活:在长事务中每 30 秒发送一个简单查询(例如 `SELECT 1`)以防止空闲检测。
无效尝试
常见但无效的做法:
-
100% 失败
Increasing the idle timeout in RDS Proxy settings is not supported; the 60-second limit is hardcoded.
-
70% 失败
Disabling connection pooling entirely removes the proxy benefit and may cause connection storms.