Score:0

Remote MySQL server returning: MySQL server has gone away / Error while sending QUERY packet

ec flag

I have 2 servers (both running Ubuntu 12.04)

APP server

  • running apache2, PHP7.2 and a CakePHP 2.0 APP

DATABASE server

  • running mysql 5.7

When I'am trying to insert into the database a big blob (starting > 40MB) the mysql server returns the following errors to the APP:

Error while sending QUERY packet

General error: 2006 MySQL server has gone away

Also in /var/log/mysql/error.log - i found the following error:

[Note] Aborted connection 123456 to db: 'database_name' user: 'database_username' host: 'remote_ip_address' (Got an error reading communication packets)


in PHP.ini, i've maxed: max_execution_time, memory_limit in MySQL configs, i've maxed wait_timeout, net_read_timeout, net_write_timeout, max_allowed_packet

I've checked free -m there is enough ram. i am not using persistent connection, i've tested multiple times and its look like failing between 19-22 seconds everytime. i don't have other idle mysql procceses.

Can you guys suggest how i can debug this futher? I have no ideas left. Maybe a firewall issue? But how i can debug that. Thanks!

ua flag
What query were you running? How long did it run before timing out? `SHOW VARIABLES LIKE '%timeout%';`
updevs avatar
ec flag
I've write it up. after 19-22 seconds. its an INSERT query of a BLOB (55MB file). all variables from `'%timeout%'` are increased to their max.
Score:0
ua flag

Not even LONGBLOB can handle more than 4GB; certainly not 55GB. Do not plan on putting that big a cell into a MySQL table.

You could break it into chunks, but that is a pain.

Instead, make a file, then have the URL provide a way to get to the file -- just a JPGs are handled on web pages.

updevs avatar
ec flag
I don't know where i write 55GB. Its happening starting with 55MB (wich is low and not a big problem to store). I cannot change the whole APP back to local storage. i need a fix for this problem. (its already in production like this for years)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.