Usually that happens when you use JOIN for combining multiple table in database. If your mysql query takes more time, then server could give you negative response like
#2013 - Lost connection to MySQL server during query
Or
MySQL server has gone away
SELECT RELEASE_LOCK('b131086dbc463d8c717e59bd41af9cdd914ce035') AS ci_session_lock
May be you have below type of query
SELECT * FROM `table1` JOIN `table2` ON `table1`.`product_id` = `table2`.`sku` JOIN `table3` ON `table1`.`user_id` = `table3`.`cust_id` WHERE `date` BETWEEN "2018-07-01" AND "2018-07-31" GROUP BY `table1`.`order_id` ORDER BY `table1`.`date` DESC, `table1`.`order_id` DESC
And your above query is showing below result
Showing rows 0 - 24 (67 total, Query took 18.9670 seconds.) [o_aaded_time: 2018-07-30 23:14:38... - 2018-07-24 01:52:02...] [o_order_id: 180730054438... - 180723082202...]
This will Killed queries for the database.
For solving this problem, you have to take below steps.
First of all, your query should be executed within 15 seconds. Currently above query is getting 18.9670 seconds. So you have to optimize your query and you have to reduce execution time below 15 seconds.
Another way for solving this issue is "Add below line into your my.cnf or my.ini in the [mysqld] section
max_allowed_packet=32M