Debugging sleeping connections I'm troubleshooting an app that has a lot of sleeping connections to my MySQL (MariaDB) server. I'd like to see just what the queries are on these sleeping connections, but when I run SHOW FULL PROCESSLIST, the Info column holds only NULL.
I suspect theses connections represent long-running queries, but it's a sizeable app, and I'm not sure what parts are creating the offending queries.
Is there a way for me to discover what the queries are?
Sleeping connections are not running queries, sleeping connections represent connections that the client/app failed to close successfully, most of the time due to bad programming practices (developers nos closing connections after querying the DB) or bad connectors configuration (not sending a close connection signal or even using an old/outdated connector).
Most of the cases this is not a big issue, but sometimes connection pool can grow out of control a represent a real hazard for real new requests traying to create new connections to the DB, so the best approach to &quot;fix&quot; this issue is to review the application/client and send a close() to the connection or check the connector.
You can also play with wait_ timeout variables to limit the time sleeping connections can remain active.