I have a web application written in php. In this app, I have a script(CLI) which is really heavy. After this script finishes its job, I get "mysql has gone away" error in my normal http request for a few minutes. For example, Last time my script finished its job around 22:38 and I was getting "mysql has gone away" for next 3 minutes.

This is the connections to mysql server(Mysql data):

Mysql Connections

And connections to mysql(using something like netstat):

Mysql connections

P.S: most of http request manage to open connection to mysql without any problems.

P.S: After a few minutes, I stop getting this error(22:42 in the chart). P.S: I get this error when opening a connection using php's PDO or when I want to execute a statement.

P.S: CPU usage is quite normal

enter image description here enter image description here enter image description here

  • Did you check the manual? dev.mysql.com/doc/refman/8.0/en/gone-away.html – rage Jun 5 '19 at 15:00
  • @LucasRamage Yes I have – undone Jun 5 '19 at 17:39
  • You need to provide relevant information, then. Just saying you read the manual is not sufficient. – Michael Hampton Jun 5 '19 at 17:47
  • This can happen if a query choke your mysql (cpu or the disk). Please include a CPU chart & IO latency chart for the server, it might answer your question. – yagmoth555 Jun 5 '19 at 17:50
  • 1
    @yagmoth555 I added those charts. – undone Jun 6 '19 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.