General error: 2006 MySQL server has gone away LARVEL VAPOR

124 views Asked by At

I am having this error thrown a few times "SQLSTATE[HY000]: General error: 2006 MySQL server has gone away". It is obviously cause by the server just going down, it always restarts after a few minutes/ The vapor setup is: RDS MySQL 8.0db.t3.large50GB From what I can tell it happens if a job on the queue takes longer than 5 minutes, the server just dies. If you could point me to the right direction or where i should look into I would very much appreciate it. Thank you

PS I rewrote/ split/batched/moved on separate queues so that is not an issue as they should not really last that long but I am trying to figure how can I ensure it just fails more gracefully as opposed to taking the full server down if that happens?

1

There are 1 answers

0
ceejayoz On BEST ANSWER

I suspect your database is closing the connection after a period of inactivity as your job works on non-database tasks.

You may be able to solve this by finding the lengthy task (presumably you're doing something like data processing or video transcoding or something?) and calling \DB::reconnect('mysql') after it.