SQLSTATE[HY000] [2002] Operation timed out

Hello,
i have application with symfony and doctrine and, mysql percona 5.7.37-40

i have this error
An exception occurred in driver: SQLSTATE[HY000] [2002] Operation timed out

it ocurrs when i try to connect to mysql but, not for all connection, more or less,
5 of 100 conections fails.

I update max_connections from 1000 to 10000 and the problems persist.

any idea about this problema?

what i can see? mysql log not showing nothing

thanks

This has nothing to do with your issue so put this back to 1000.

Your issue is that you are not properly closing database connections and PHP is trying to re-use a connection. Your code needs to explicitly close connections and then re-open them as needed. Also, check the queries that are running when this happens. It may be a bad query that is taking too long and the operation times out.

1 Like