# RDS 代理连接已终止：事务空闲超时（60 秒）

- **ID:** `aws/rds-proxy-idle-connection-timeout`
- **领域:** aws
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

RDS 代理默认强制执行 60 秒事务空闲超时，终止持有打开事务但无活动的连接。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| RDS Proxy 1.0 | active | — | — |
| aurora-mysql-8.0 | active | — | — |
| postgresql-15.4 | active | — | — |

## 解决方案

1. ```
   在数据库中设置更高的 `idle_in_transaction_session_timeout` 值（例如 `SET idle_in_transaction_session_timeout = '120000';`）以允许更长的空闲事务。
   ```
2. ```
   实现应用层保活：在长事务中每 30 秒发送一个简单查询（例如 `SELECT 1`）以防止空闲检测。
   ```

## 无效尝试

- **** — Increasing the idle timeout in RDS Proxy settings is not supported; the 60-second limit is hardcoded. (100% 失败率)
- **** — Disabling connection pooling entirely removes the proxy benefit and may cause connection storms. (70% 失败率)
