1

I've been battling this issue for quite some time now and I'm at a complete loss as to where to look for clues.

The situation in short is this: We have a custom module to define product-packages with discounts. Whenever someone has a product-package in their cart and the product gets edited (in price i.e.) in the backend, their session crashes and the customer gets 504 errors for the whole shop. The website keeps running fine for others.

The only way to remedy this is to undeploy and deploy the custom module again. Do this, and the site will work properly again. This is obviously due a programming error in the module, but how can I get to the root cause of it? I don't know where to look as there are no error logs whatsoever whenever the 504 Error pops up.

I'm not looking for an exact answer to this problem, but more in general; when something like this happens and is related to a module; where do I look to find the root cause? How can I catch the 504 before it happens?

Edit: I've enabled the MySQL logs and this is what it returns when reloading the frontend after editing the product in the backend:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away, query was: SELECT `cms_page`.* FROM `cms_page`
 INNER JOIN `cms_page_store` ON cms_page.page_id = cms_page_store.page_id WHERE (`cms_page`.`identifier`='no-route') AND (is_active = 1) AND (cms_page_store.store_id IN (0, 1)) ORDER BY `cms_page_store`.`store_id` DESC LIMIT 1

#0 /usr/share/nginx/html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /usr/share/nginx/html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /usr/share/nginx/html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /usr/share/nginx/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `cms_pag...', Array)
#4 /usr/share/nginx/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `cms_pag...', Array)
#5 /usr/share/nginx/html/lib/Zend/Db/Adapter/Abstract.php(756): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `cms_pag...', Array)
#6 /usr/share/nginx/html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(380): Zend_Db_Adapter_Abstract->fetchRow(Object(Varien_Db_Select))
#7 /usr/share/nginx/html/app/code/core/Mage/Cms/Model/Resource/Page.php(170): Mage_Core_Model_Resource_Db_Abstract->load(Object(Mage_Cms_Model_Page), 'no-route', 'identifier')
#8 /usr/share/nginx/html/app/code/core/Mage/Core/Model/Abstract.php(225): Mage_Cms_Model_Resource_Page->load(Object(Mage_Cms_Model_Page), 'no-route', 'identifier')
#9 /usr/share/nginx/html/app/code/core/Mage/Cms/Model/Page.php(113): Mage_Core_Model_Abstract->load('no-route', NULL)
#10 /usr/share/nginx/html/app/code/core/Mage/Cms/Helper/Page.php(74): Mage_Cms_Model_Page->load('no-route')
#11 /usr/share/nginx/html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'no-route')
#12 /usr/share/nginx/html/app/code/core/Mage/Cms/controllers/IndexController.php(75): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'no-route')
#13 /usr/share/nginx/html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->noRouteAction()
#14 /usr/share/nginx/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('noRoute')
#15 /usr/share/nginx/html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#16 /usr/share/nginx/html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#17 /usr/share/nginx/html/app/Mage.php(691): Mage_Core_Model_App->run(Array)
#18 /usr/share/nginx/html/index.php(84): Mage::run('', 'store')
#19 {main}

And this is the my.cnf for MySQL: [client] port = 3306 socket = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
key_buffer      = 16M
max_allowed_packet  = 16M
thread_stack        = 192K
thread_cache_size       = 8
myisam-recover         = BACKUP
query_cache_limit   = 1M
query_cache_size        = 16M

log_error = /var/log/mysql/error.log
expire_logs_days    = 10
max_binlog_size         = 100M

[mysqldump]
quick
quote-names
max_allowed_packet  = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer      = 16M

!includedir /etc/mysql/conf.d/
  • Could you post your MySQL Error log and complete text of my.cnf for analysis? – Wilson Hauck Jul 4 '18 at 20:19
  • 1
    @WilsonHauck; Done! I hope you're able to make any sense of it, because I sure can't! – Alex Timmer Jul 5 '18 at 8:15
  • Please post results of SELECT @@threads_created; Thanks – Wilson Hauck Jul 5 '18 at 13:00
  • 1
    Please review my profile, Network profile for contact info, including Skype Id and try to connect. Thanks – Wilson Hauck Jul 8 '18 at 17:53
  • 1
    Hi @WilsonHauck, I added you in Skype (if I'm correct) – Alex Timmer Jul 12 '18 at 11:12
0

Suggestion to consider for your my.cnf [mysqld] section

thread_cache_size=100  # from 8 to avoid thread starved server

Keep us posted after applying to production, please.

| improve this answer | |
  • @alextimmer from your Production server, Please post on pastebin.com or here. RAM size of your MySQL Host server A) complete (not edited) my.cnf or my.ini Text results of: B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) complete MySQLTuner report Optional very helpful information, if available includes - htop or top for most active apps, ulimit -a for a linux/unix list of limits, iostat -x when system is busy for an idea of IOPS by device, df -h for a linux/unix free space list by device, for server tuning analysis. – Wilson Hauck Aug 23 '18 at 13:24
  • @alextimmer Please visit www.mysqlservertuning.com, review What We Do, Data We Need, SHOP, select FREE My TOP 10 Global Variable Suggestions for additional tuning suggestions for your production server, please. – Wilson Hauck Sep 17 '18 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.