In MySQL configuration, there is a parameter called "wait_timeout", this parameter means roughly like this: when a client connects to MySQL database, if the client doesn't disconnect itself and doesn't do any operation, MySQL database will keep this connection "wait_timeout" for such a long time (in s, default is 28800s, i.e. 8 hours). (unit is s, default is 28800s, that is, 8 hours), after this time, MySQL database will disconnect the connection in order to save resources; of course, during this process, if the client has any operation on this connection, MySQL database will start calculating this time again.
Yesterday, I used supervisor to do process management for queues, using queue:work, and a question came to mind: queue:work runs all the time, so if there are no tasks for a long period of time, does it send a timeout to the database connection? In the current scenario, I found that the error "2006 MySQL server has gone away" appears occasionally, but it is normal to check the database, I am currently using version 10.x, and after checking the source code, I found that there is a way to recheck whether the database has been connected, but I found that it does not work. What is the problem?
Laravel Version
10.4.1
PHP Version
8.1.4
Database Driver & Version
mysql 8.0
Description
In MySQL configuration, there is a parameter called "wait_timeout", this parameter means roughly like this: when a client connects to MySQL database, if the client doesn't disconnect itself and doesn't do any operation, MySQL database will keep this connection "wait_timeout" for such a long time (in s, default is 28800s, i.e. 8 hours). (unit is s, default is 28800s, that is, 8 hours), after this time, MySQL database will disconnect the connection in order to save resources; of course, during this process, if the client has any operation on this connection, MySQL database will start calculating this time again. Yesterday, I used supervisor to do process management for queues, using queue:work, and a question came to mind: queue:work runs all the time, so if there are no tasks for a long period of time, does it send a timeout to the database connection? In the current scenario, I found that the error "2006 MySQL server has gone away" appears occasionally, but it is normal to check the database, I am currently using version 10.x, and after checking the source code, I found that there is a way to recheck whether the database has been connected, but I found that it does not work. What is the problem?
Steps To Reproduce
in queue scenario