amphp/mysql

Connection went away, after wait_timeout expired

bwoebi opened this issue · 1 comments

mysql has a setting to kill idle connections after a while: wait_timeout - https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout - with a default of 8 hours.

This regularly causes exceptions on very low-frequency ends, while it would be easily avoidable if we restarted connections from time to time.

We might desire to request that timeout from the server via SHOW VARIABLES LIKE 'wait_timeout' on pool startup and restart (or just kill them as long as more than 2 connections are available) the idling connections if their last use gets dangerously close to wait_timeout.

Pools now automatically drop idle connections after a configurable timeout (default of 60 seconds), so I believe this is no longer an issue.