Hi! 👋 We are doing a big documentation refresh. Help us improve — what's missing or could be better? Let us know! Simply send an email or start a conversation in Google Groups!

Killed Client Connection Warnings

Closing killed client connection <IP>:<PORT> is the final cleanup message for a client session that ProxySQL has already marked for termination. It reports cleanup, not the original reason for the kill.

Kill Decision and Final Cleanup

Connection termination has two distinct log points:

  1. Kill decision: Timeout-driven and some automatic conditions mark the session as killed and first log a Killing client connection ... because ... warning. Explicit Admin session termination or a client KILL CONNECTION request marks the session without that reason warning.
  2. Final cleanup: A worker removes the already-killed session and logs Closing killed client connection <IP>:<PORT>.

Correlate messages by client address and port and account for log rotation. If the complete log window contains the cleanup warning but no earlier reason warning for that connection, investigate an explicit KILL command.

Causes

CauseDecision-phase warningWhere to investigate
Client idle longer than the effective wait timeoutKilling client connection ... because inactive for <ms>msmysql-wait_timeout and a client-specific SET wait_timeout value
Open transaction idle too longKilling client connection ... because of (possible) transaction idle for <ms>msmysql-max_transaction_idle_time
Transaction runs too longKilling client connection ... because of (possible) transaction running for <ms>msmysql-max_transaction_time
A fast-forward session uses an offline backendKilling client connection ... due to 'session_fast_forward' and offline backendsBackend status and the session’s fast-forward configuration
Admin session termination or client KILL CONNECTIONNo separate reason warningAudit records, automation, connection-pool behavior, and application logs

Timeout values are milliseconds. Compare them with the application’s connection-pool lifetime and idle-time settings before changing them.

Message Pattern Diagnosis

What the log shows for one client address and portLikely diagnosisNext action
A Killing client connection ... because ... warning followed by Closing killed client connection ...The first warning identifies a timeout or other automatic decision; the second is cleanup.Investigate the named timeout or backend state.
Only Closing killed client connection ... in the complete log windowAn explicit Admin or client kill marked the session without a reason warning.Trace client statements through query event logging; correlate the victim session with audit lifecycle events; check command counters, process-list samples, application logs, and Admin automation.

Diagnosing Explicit Kills

Audit logging records connection lifecycle events and can help correlate the victim session’s authentication and close records, but it does not record query text and therefore cannot identify who issued KILL CONNECTION. To capture client-issued statements, use controlled query event logging scoped with query rules, and protect the output because it contains client activity. Review application logs and the logs of Admin scripts and automation separately for Admin-interface session termination. Then use the statistics tables to quantify and sample the behavior:

SELECT *
FROM stats_mysql_commands_counters
WHERE UPPER(Command) = 'KILL';

SELECT ThreadID, SessionID, user, cli_host, cli_port, info
FROM stats_mysql_processlist
WHERE info LIKE 'KILL%';

The command counter is cumulative and the process list is only a current snapshot, so a short-lived command may not appear in the latter. A KILL QUERY can contribute to the command counter but cancels the running backend query rather than marking the client session killed, so it does not by itself explain this cleanup warning. See stats_mysql_commands_counters and stats_mysql_processlist for their schemas and collection behavior.

Also review application and connection-pool logs, scheduled admin jobs, health checks, and incident automation for commands targeting the same connection. Do not suppress the cleanup warning until the source of unexpected kills is understood.