0

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();
marius
  • 1,118
  • 1
  • 18
  • 38
  • After **24 hours** the database connection most probably timed out... – ndm Jan 22 '18 at 15:40
  • how is this ran? do you have many long running processes? You either have many connections opened. Or a connection used by a parent process is killed before the child process can make use of it again. Insight into your set up will help – yomexzo Jan 22 '18 at 17:16

0 Answers0