I have the situation where I use the TableRegistry of CakePHP in a script that acts like a server. It first works, but if there was no trafic for around one day, the server still runs but once the TableRegistry is used, it produces the following error: Warning Error: Error while sending QUERY packet. PID=2536 in [..vendor\cakephp\src\Databse\Statement\MysqlStatement.php, line 39]
Googling for the error results in:
MySQL have limitation for size of data
Which cannot be the case, since the query and the corresponding result is really small. I have the feeling that the CakePHP Mysql connection somehow times out internally.
Here is my coding for reporducing the error:
namespace WebsocketServer;
//load the cakePHP classes
require_once '../config/bootstrap.php';
use Cake\ORM\TableRegistry;
class Server {
public function query() {
//any data fetch mockup (the
$data = TableRegistry::get('Screens')->find()->all()->toArray();
}
}
$server = new Server();
//querying works perfecly
$server->query();
//wait for a day
sleep(60*60*24);
//querying results in an error
$server->query();