Use tp5 combined with workerman to build a chat room; after about 24 hours of normal operation, the command line reports an error and prompts memory overflow. What's wrong with this?

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.


other possible reasons:

  1. check whether the database query has a large result set?
  2. Are static variables heavily used in
  3. scripts?

PHP memory management pot
there is a mechanism like PHP-FPM that exits the process as many requests as the child process receives. The key reason for
is that some extended memory has overflowed. There may not be much in a short time, maybe a few KB, but not for a long time.
personal recommendation is to cooperate with pm2 or docker to implement memory management. If the memory exceeds the limit, it is forced to restart directly

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e97ebd-5c4b0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e97ebd-5c4b0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?