problem description:
workerman starts normally, and the client can send and receive messages normally, but memory overflow occurs after a long connection.
has also encountered a problem before. After 8 hours of normal operation of workerman, an error of Error while sending QUERY packet PID=xxxx
will be reported. After troubleshooting, it is found that it is the database caching mechanism of tp5, and the connection will be disconnected automatically after 8 hours. The problem was resolved after the database profile configuration allowed disconnection and reconnection, followed by the error just described.
error message:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24 bytes) in E:\phpStudy\WWW\study\thinkphp\library\think\db\Connection.php on line 766
operating environment and framework version:
Windows Server 2016
php 5.6.27
apache 2.4.18
mysql 5.5.53
thinkphp 5.1.0
workerman 3.5.1
the solution I have tried:
thought about finding the cause alone from the direction of workerman before, but no one encountered a similar error like mine.
at first thought that too many connections led to memory overflow, but I tested that none of the 600 client connections caused a crash (this is about the number of peak users in this program). Then check whether it is because the user disconnected did not do the operation of releasing memory, and found that the identifier was released after the user disconnected.
wants to look in the direction of tp5, and I wonder if it is because the database configuration allows disconnection and reconnection, which leads to memory overflow due to long connections. However, if disconnection reconnection is not allowed, it will not meet the requirement of memory overflow for 8 hours, so this method cannot test whether the overflow is caused by disconnection reconnection.
to no avail, I would like to ask if anyone has ever encountered a problem similar to mine.