Analysis of Mysql Error Problem Caused by php's Slow Log
- 2021-06-28 11:31:10
- OfStack
In our project, open the slow log for PHP (request_slowlog_timeout = 10s) is mandatory, and it also allows us to find many pits and solve many performance problems.
Yesterday we had to close the PHP slow log due to a very strange problem. What is the problem?
Question: When executing the program, report to 2013 (Lost connection to MySQL server during query)
Analysis:
1) In our background program, a loop is executed (
>
300 times), an SQL statement is repeated in the loop;
2) Access log of Nginx, each time the program runs, it takes about 12 seconds;
3) Modify the mysql connection class to execute mysql_before queryping is also invalid and the problem remains.
When I was puzzled, I thought I would close the php slow log for a try, and then I could imagine that the problem was really good...
As for the reason of the horse, I really don't know. Seek the truth!