Skip to content

ProxySQL closes idle Sequel Ace frontend sessions after ~15 minutes although no matching timeout is configured #6163

Description

@gausssss

Environment

  • ProxySQL version: 2.5.5-10-g195bd70
  • Deployment: Docker Compose on an Amazon Linux 2 bastion host
  • Backend: Amazon Aurora MySQL
  • Client: Sequel Ace for macOS, connected through an SSH tunnel

Description

When Sequel Ace connects to Aurora MySQL through ProxySQL over an SSH tunnel, the connection is
consistently lost after approximately 15 minutes of complete inactivity.

The same Sequel Ace connection through the same bastion host, but directly to the Aurora endpoint
without ProxySQL, remains connected for at least 20 minutes.

The issue only occurs when ProxySQL is in the path.

Expected behavior

The idle frontend session should remain connected until the configured ProxySQL frontend idle
timeout (mysql-wait_timeout) expires, or ProxySQL should return a clear error explaining why the
session is closed.

Actual behavior

After approximately 15 minutes of inactivity, Sequel Ace shows:

Connection Lost
Sequel Ace appears to have lost the connection to the server, or the server has stopped
responding.

ProxySQL logs:

MySQL_Thread.cpp:3942:process_all_sessions():
[WARNING] Closing unhealthy client connection 172.20.0.1:<client_port>

The corresponding sessions disappear from stats.stats_mysql_processlist.

## Reproduction steps

1. Create a new Sequel Ace connection through SSH to ProxySQL port <my-port>.
2. Execute:

   SELECT 1;

3. On the ProxySQL Admin interface, record the session details:

   SELECT SessionID, cli_host, cli_port, hostgroup, command, time_ms
   FROM stats.stats_mysql_processlist
   WHERE user = '<my-user>';

4. Do not execute SQL or operate Sequel Ace for 15–20 minutes.
5. Execute:

   SELECT 1;

6. The Sequel Ace connection is lost.

## Relevant findings

### Aurora session values

Both direct Aurora connections and ProxySQL connections report:

SELECT
  @@session.wait_timeout,
  @@session.interactive_timeout,
  @@session.autocommit,
  DATABASE();

Result:

wait_timeout        = 600
interactive_timeout = 600
autocommit          = 1
DATABASE()          = NULL

However, direct Aurora connections remain alive for at least 20 minutes.

### No active transaction

SELECT *
FROM information_schema.innodb_trx
WHERE trx_mysql_thread_id = CONNECTION_ID();

Result: empty set.

### Relevant ProxySQL global variables

mysql-wait_timeout              = 28800000  # 8 hours
mysql-default_query_timeout     = 86400000  # 24 hours
mysql-max_transaction_idle_time = 14400000  # 4 hours
mysql-max_transaction_time      = 14400000  # 4 hours
mysql-connection_max_age_ms     = 0
mysql-use_tcp_keepalive         = false
mysql-tcp_keepalive_time        = 0
mysql-multiplexing              = true
mysql-session_idle_ms           = 1

We also tested:

mysql-use_tcp_keepalive = true
mysql-tcp_keepalive_time = 60

The issue still reproduced.

### Query rules

No active query rule has a non-NULL timeout value.

The user is routed by this rule:

rule_id: <my-rule_id>
username: <my-user>
destination_hostgroup: <my-hostgroup>
timeout: NULL
apply: 1

### Packet capture

We captured FIN/RST packets during reproduction:

sudo tcpdump -i any -nn -tttt \
  'tcp port <my-port> and (tcp[tcpflags] & (tcp-fin|tcp-rst) != 0)'

For the affected ProxySQL client sessions, the first FIN was sent by the ProxySQL container:

172.20.0.2:<my-port> > 172.20.0.1:<client_port>: Flags [F.]

The Docker proxy and SSHD then propagated the connection close.

## Question

Is there any ProxySQL 2.5.5 behavior, undocumented setting, or known issue that can cause an idle
frontend session to be marked unhealthy and closed after approximately 15 minutes, despite:

- mysql-wait_timeout being 8 hours,
- no matching query-rule timeout,
- no active transaction, and
- ProxySQL itself sending the first FIN packet?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions