aws runtime_error ai_generated partial

RDS Proxy connection terminated: idle in transaction timeout (60 seconds)

ID: aws/rds-proxy-idle-connection-timeout

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
1Evidence
2024-06-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
RDS Proxy 1.0 active
aurora-mysql-8.0 active
postgresql-15.4 active

Root Cause

RDS Proxy enforces a 60-second idle transaction timeout by default, terminating connections that hold open transactions without activity.

generic

中文

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

Official Documentation

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

Workarounds

  1. 85% success Set `idle_in_transaction_session_timeout` to a higher value in the database (e.g., `SET idle_in_transaction_session_timeout = '120000';`) to allow longer idle transactions.
    Set `idle_in_transaction_session_timeout` to a higher value in the database (e.g., `SET idle_in_transaction_session_timeout = '120000';`) to allow longer idle transactions.
  2. 90% success Implement application-level keepalive: send a simple query (e.g., `SELECT 1`) every 30 seconds within long transactions to prevent idle detection.
    Implement application-level keepalive: send a simple query (e.g., `SELECT 1`) every 30 seconds within long transactions to prevent idle detection.

中文步骤

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

Dead Ends

Common approaches that don't work:

  1. 100% fail

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

  2. 70% fail

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