D
D
Daniil Vshivtsev2017-07-15 08:07:36
PHP
Daniil Vshivtsev, 2017-07-15 08:07:36

Why does Error while sending QUERY packet occur in MariaDb?

Greetings.
Available server with Centos 7.2 and 5.5.52-MariaDB; about 200 php daemons are spinning, each has its own connection to the database via PDO; in the database a table with 300 thousand rows and a weight of 50 MB.
Periodically (per hour for 5-7 pieces) demons fall off with the error "Error while sending QUERY packet". At the same time, everyone makes 200-300 requests per hour, i.e. daemons don't die the first time they access the database. All requests - update rows by id (primary key) or select by id - are executed in a tenth of a second.
I read that a possible problem is wait_timeout or max_allowed_packet , changed them to 600 and 1024M respectively, restarted the database daemon, but the problem recurred.
What are your thoughts on this?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniil Vshivtsev, 2017-07-15
@dahujika

I'll answer myself.
Short version: in the pdo constructor, add an array with as the fourth parameter PDO::MYSQL_ATTR_MAX_BUFFER_SIZE=>1024*1024*50,
where the number is the size of the packet in bytes.
Full version:
A common recommendation for this kind of error is to increase wait_timeout and max_allowed_packet
in the config file (/etc/my.cnf in my case), didn't help me. Details here .
They helped:
1. msyql documentation , which states that you must increase this variable both in the client and in the server
2. topic that pdo is to blame for everything
3. commenton php.net that pdo has its own MYSQL_ATTR_MAX_BUFFER_SIZE setting, which should be increased.

M
modx4web-n-mobile, 2019-04-02
@modx4web-n-mobile

Hi Daniel,
thanks for sharing this question - do you happen to know how to overcome this in xPDO, which is used in MODX CMS? Maybe even make a hardcode temporarily ... I will be glad to review

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question