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

其他格式: JSON · Markdown 中文 · English
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.

generic

官方文档

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html#rds-proxy-idle-timeout

解决方案

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

无效尝试

常见但无效的做法:

  1. 100% 失败

    Increasing the idle timeout in RDS Proxy settings is not supported; the 60-second limit is hardcoded.

  2. 70% 失败

    Disabling connection pooling entirely removes the proxy benefit and may cause connection storms.