Page 1 of 1

SQL Error

Posted: Thu Sep 05, 2019 12:30 am
by awuk
Hi Can any one help

since yesterday we are getting this error

Any one got any ideas on how to fix?

Code: Select all

Warning: mysqli::query(): MySQL server has gone away in /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/library/db/mysqli.php on line 18Warning: mysqli::query(): Error reading result set's header in /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/library/db/mysqli.php on line 18
Fatal error: Uncaught Exception: Error: MySQL server has gone away<br />Error No: 2006<br />SELECT COUNT(DISTINCT p.product_id) AS total FROM oc_product p LEFT JOIN oc_product_description pd ON (p.product_id = pd.product_id) WHERE pd.language_id = '1' AND p.price LIKE '%' in /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/library/db/mysqli.php:40 Stack trace: #0 /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/library/db.php(45): DB\MySQLi->query('SELECT COUNT(DI...') #1 /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/storage2atmy98p64me/modification/admin/model/catalog/product.php(1332): DB->query('SELECT COUNT(DI...') #2 /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/storage2atmy98p64me/modification/system/engine/loader.php(248): ModelCatalogProduct->getTotalProducts(Array) #3 /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/engine/proxy.php(47): Loader->{closure}(Array, Array) #4 /home/airsoftwcom/domains/airsoftwholesale in /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/library/db/mysqli.php on line 40

Fatal error: Uncaught Exception: Error: MySQL server has gone away<br />Error No: 2006<br />REPLACE INTO `oc_session` SET session_id = 'd3443c4b8647582c93d3ff10c7', `data` = '{\"language\":\"en-gb\",\"currency\":\"GBP\",\"install\":\"V94sI3RJXf\",\"filter_date_start\":\"\",\"filter_date_end\":\"\",\"filter_range\":\"current_year\",\"filter_report\":\"sales_summary\",\"filter_details\":\"no_details\",\"filter_group\":\"month\",\"filter_sort\":\"report_type\",\"filter_order\":\"desc\",\"filter_limit\":25,\"filter_status_date_start\":\"\",\"filter_status_date_end\":\"\",\"filter_order_status_id\":\"\",\"filter_order_id_from\":\"\",\"filter_order_id_to\":\"\",\"filter_order_value_min\":\"\",\"filter_order_value_max\":\"\",\"filter_store_id\":\"\",\"filter_currency\":\"\",\"filter_taxes\":\"\",\"filter_tax_classes\":\"\",\"filter_geo_zones\":\"\",\"filter_customer_group_id\":\"\",\"filter_customer_name\":\"\",\"filter_customer_email\":\"\",\"filter_customer_telephone\":\"\",\"filter_ip\":\"\",\"filter_payment_company\":\"\",\" in /home/airsoftwcom/domains/airsoftwholesaleuk.com/public_html/system/library/db/mysqli.php on line 40

Re: SQL Error

Posted: Fri Sep 06, 2019 6:06 pm
by dparakhiya
contact your hosting provider in order to resolve this issue.

Re: SQL Error

Posted: Fri Sep 06, 2019 6:57 pm
by thekrotek
The error says for itself: "MySQL server has gone away".

Re: SQL Error

Posted: Fri Sep 06, 2019 9:01 pm
by letxobnav
It means that the established connection to the database has timed out.

Could be that you are using persistent connections which also time out and then give that warning if they are not explicitly closed.
Could be that your script takes to long between queries and the connection is dropped in between.
Could also be a memory allocation problem.

To prevent it in any case would be to close the connection after every database access but that would add overhead delay.
Another option is to check if the link is still up before db access and if not reconnect, that would eliminate the warning as well.

Timeouts are set via variables:

connect_timeout
wait_timeout
interactive_timeout

Re: SQL Error

Posted: Tue May 12, 2020 8:42 am
by kekey
tolong pencerahanya ini kenapa ya, saya install theme topdeal gk bisa2 selalu error saat proses upload

Code: Select all

PHP Warning: mysqli::query(): MySQL server has gone away in /home/u858002734/domains/pegibelanja.com/public_html/system/library/db/mysqli.php on line 18
PHP Warning: mysqli::query(): Error reading result set's header in /home/u858002734/domains/pegibelanja.com/public_html/system/library/db/mysqli.php on line 18

Re: SQL Error

Posted: Tue May 12, 2020 8:46 am
by straightlight
kekey wrote:
Tue May 12, 2020 8:42 am
tolong pencerahanya ini kenapa ya, saya install theme topdeal gk bisa2 selalu error saat proses upload

Code: Select all

PHP Warning: mysqli::query(): MySQL server has gone away in /home/u858002734/domains/pegibelanja.com/public_html/system/library/db/mysqli.php on line 18
PHP Warning: mysqli::query(): Error reading result set's header in /home/u858002734/domains/pegibelanja.com/public_html/system/library/db/mysqli.php on line 18
This is an English forum. Contact your host regarding this specific SQL issue.

Re: SQL Error

Posted: Mon Jun 01, 2020 9:21 am
by foobarac
Guys, it's not always the Host servers fault in this case.

The DB transaction is inflight so if you have modules/processes that do other things during the process i.e send emails out to confirm an order or confirm the opening of an account, and this hangs - then you are going to get the "PHP Warning: mysqli::query(): MySQL server has gone away" in your error logs.

However the problem could be that your SMTP server is hanging (which was my problem).