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):
And connections to mysql(using something like netstat):
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