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:
- 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 clientKILL CONNECTIONrequest marks the session without that reason warning. - 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
| Cause | Decision-phase warning | Where to investigate |
|---|---|---|
| Client idle longer than the effective wait timeout | Killing client connection ... because inactive for <ms>ms | mysql-wait_timeout and a client-specific SET wait_timeout value |
| Open transaction idle too long | Killing client connection ... because of (possible) transaction idle for <ms>ms | mysql-max_transaction_idle_time |
| Transaction runs too long | Killing client connection ... because of (possible) transaction running for <ms>ms | mysql-max_transaction_time |
| A fast-forward session uses an offline backend | Killing client connection ... due to 'session_fast_forward' and offline backends | Backend status and the session’s fast-forward configuration |
Admin session termination or client KILL CONNECTION | No separate reason warning | Audit 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 port | Likely diagnosis | Next 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 window | An 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.