开发者

Drupal website blocked because of many connection errors - website goes offline

开发者 https://www.devze.com 2023-03-11 08:21 出处:网络
From time to time, the number of database connections from our Drupal 6.20 system to our Mysql database reaches 100-150 and after a while the website goes offline. The error message when trying to con

From time to time, the number of database connections from our Drupal 6.20 system to our Mysql database reaches 100-150 and after a while the website goes offline. The error message when trying to connect to Mysql manually is "blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'". Since the database is hosted on an Amazon RDS I don't have the permission to issue this command, but I can reboot the database and once rebooted the website works normally again. Until next time.

Drupal reports multiple errors prior to going offline, of two types:

Duplicate entry '279890-0-all' for key 'PRIMARY' query: node_access_write_grants /* Guest : node_access_write_grants */ INSERT INTO node_access (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (279890, 'all', 0, 1, 0, 0) in /var/www/quadplex/drupal-6.20/modules/node/node.module on line 2267.

Lock wait timeout exceeded; try restarting transaction query: content_write_record /* Guest : content_write_record */ UPDATE content_field_rating SET vid = 503621, nid = 503621, field_rating_value = 1212 WHERE vid = 503621 in /var/www/quadplex/drupal-6.20/sites/all/modules/cck/content.module on line 1213.

The nids in these two queries are always the same and refer to two nodes that are frequently automatically updated by a custom module. I can track down a correlation between these errors and unusually many web requests in the Apache logs. I would understand that the website would become slower because of this. But:

  1. Why do these errors occur, and how can they be solved? It seems to me it's to do with several web requests trying to update the same node at the same time. But surely Drupal should deal with this by locking the tables etc? Or should I de开发者_运维百科al with it in some special way?

  2. Despite the higher web load, why does the database completely lock and require to be rebooted? Wouldn't it be better if the website still had access to Mysql and so, once the load is lower, it can serve pages again? Is there some setting for this?

Thank you!


Can be solved one or all of these three things to check:

  1. are you out of disk space? From ssh, type command df -h and make sure you still have disk space.

  2. Are the tables damaged? Repair the tables in phpMyAdmin, or CLI instructions here: http://dev.mysql.com/doc/refman/5.1/en/repair-table.html

  3. Have you performance-tuned your mysql with an /etc/my.cnf? See this for more ideas: http://drupal.org/node/51263

0

精彩评论

暂无评论...
验证码 换一张
取 消