0

I have a WordPress install on a dedicated server with decent memory (upwards of 8GB).

The WordPress install includes many plugins - 50 active plugins. Most important to note is the WPML plugin to make WordPress multilingual. The theme is Weaver II Pro.

The stack is LAMP - CentOS 6.3, Apache 2.4.4, Percona MySQL, PHP-FPM.

I have been quite stupid, and didn't set up a test or staging server.

Everything was running fine till I updated to WordPress 3.8, and also updated several plugins at the same time.

I didn't pay attention at the time, but all my widgets got messed up, and so did any sort of navigation etc.

I enabled error_log for a bit, i.e.

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');

This resulted in an immense file - basically the error_log grows by about a GB every 4 minutes or so.

The primary error I found in the error log was database server disconnect, better known as

MySQL server has gone away

The first priority was to patch the problem. So I installed Database Ping plugin. This mostly, though not completely solved the issue. Many of the widgets came back.

However, the special (non-English) characters are all messed up (converted to question marks). I tried to fix this by opening wp-mysql-ping.php and commenting out

if ( !DB_CHARSET && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>='))
                                    {
                                        $this->query("SET NAMES '" . DB_CHARSET . "'");
                                    }

Didn't help.

Besides, the plugin is not a permanent or complete solution. So leaving the site in this messed up state, I started working on other possibilities:

As suggested at Rackspace, I edited my.cnf to add

wait_timeout = 60

Didn't help.

Also added caching to my.cnf

query_cache_type = 1
query_cache_limit = 8M
query_cache_size = 512M

Didn't help.

(and yes, I restarted mysql every time I edited my.cnf)

Also tried the method suggested here: In wp-db.php before

$this->select( $this->dbname, $this->dbh );

I added

$this->query("set session wait_timeout=600" );

Didn't help.

I'm at my wit's end. Please help!

  • "This resulted in an immense file - basically the error_log grows by about a GB every 4 minutes or so."-- your site has serious issues-- my guess is very seriously sloppy code. If you have as much memory as you say, I'd increase the MySQL cache by quite a bit. – s_ha_dum Jan 22 '14 at 14:28
  • There is no custom coding. Latest WordPress and standard plugins from WP.org repo (apart from wpml) – OC2PS Jan 22 '14 at 15:32
  • Many very common plugins have very sloppy and inefficient code. 4GB of error log in 4 minutes is staggering. – s_ha_dum Jan 22 '14 at 16:22
  • How do I figure out which plugin(s) is/are at fault here? Without deactivating and reactivating them of course? – OC2PS Jan 23 '14 at 4:10
  • Server logs should have references to particular files. – s_ha_dum Jan 23 '14 at 4:14
1

Fixed this by setting max_allowed_packet = 16M in my.cnf and restarting mysql

  • You may want to examine your SQL statements being run using something like the Debug Bar plugin, and figure out what query is so large that it's breaking your max packet size. – Otto Jan 27 '14 at 17:01
  • Debug Bar seems to indicate there are 729 queries! Will check the big/slow ones... – OC2PS Jan 31 '14 at 6:48
  • I've a production (remote hosting) and a development (local) environment and on production have the same problem, tried to set max_allowed to 8M on development but still doesn't see the problem, so probably the problem is the mysql config (and the number/quality of plugins used and queries generated) but not just this parameter. – Alex Apr 18 '14 at 16:36

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.