Closed parsibox closed 1 month ago
Do you instantiate a new database connection for each request or do you retrieve it from a database connection pool? If you are retrieving the database connection from a connection pool, you may need to attempt a reconnection when disconnected.
Do you instantiate a new database connection for each request or do you retrieve it from a database connection pool? If you are retrieving the database connection from a connection pool, you may need to attempt a reconnection when disconnected.
i use separate pdo connection in each Coroutine i think some function like ksort , sort or fetch big data from mysql blocked whole my file
when my query have more than 30000 result mysql say
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
my time_wait and other config on mysql is set but we get error on this step i think when we use fetchAll or foreach or some other function that take long time whole of our Coroutine blocked for that process is it true? if it is true how can we fix this problem?
It sounds like you need to increase "max_allowed_packet" in your mysql config my.ini
Try to reconnect to the database. reference
最佳的方案是进行断线重连
You should catch this exception and reconnect to the MySQL server after disconnection.
hi i have 10 Coroutine and each of them have separate conenction to mysql with pdo in each Coroutine i have a select to mysql and fetch data
when my query have more than 30000 result mysql say
PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
my time_wait and other config on mysql is set but we get error on this step i think when we use fetchAll or foreach or some other function that take long time whole of our Coroutine blocked for that process is it true? if it is true how can we fix this problem?