Hi,
On a new drupal installation I am getting hundreds of thousands of memcache warnings telling me stuff like this:
Spent 99.09 ms splitting 4,781,831 byte object into 5 pieces, cid = cache_bootstrap-variables
Now I know what this is, memcache only allows objects upto to 1mb, so the memcache module splits it into pieces. It seems the memcache_log_data_pieces would trigger the conditional to register the shutdown function which is sending the watchdog logs, as it is set to 2 by default. However I have set this to 10, checked with drush vget and php-eval that it is set to 10, and I am still getting the logs. I tried adding in a flag past the conditional to see if it was evaluating to true, and it's either not (which it shouldn't be anyway as it's set to 10), or it's not reaching this function.
if (variable_get('memcache_log_data_pieces', 2) && $piece_count >= variable_get('memcache_log_data_pieces', 2)) {
if (function_exists('format_size')) {
$data_size = format_size(strlen($data));
}
else {
$data_size = number_format(strlen($data)) . ' byte';
}
register_shutdown_function('watchdog', 'memcache', 'Spent !time ms splitting !bytes object into !pieces pieces, cid = !key', array('!time' => timer_read('memcache_split_data'), '!bytes' => $data_size, '!pieces' => $piece_count, '!key' => dmemcache_key($key, $bin)), WATCHDOG_WARNING);
}
Is there something I need to do to get it to un register this exit function perhaps? It's clogging up the logs, there's nothing but memcache in there.
Comments
Comment #2
Jeremy CreditAttribution: Jeremy at Tag1 Consulting commentedI've verified that this logic works as designed locally. Perhaps you're overwriting the
$conf
array later insettings.php
.You should have something like this in your
settings.php
:Perhaps try moving this down to the very last line of your
settings.php
configuration file? If that doesn't work, perhaps you're editing the wrongsettings.php
file? You could try editingdmemcache.inc
directly, changingif (variable_get('memcache_log_data_pieces', 2)
toif (variable_get('memcache_log_data_pieces', 10)
.Note, it's also a good idea to try and keep the size of your cache tables smaller if possible. Perhaps there's things currently being written to cache_bootstrap-variables that don't need to be there?
Comment #3
michaelmallett CreditAttribution: michaelmallett commentedThanks for the response. Currently in our local_settings.php (our settings.php is default except for the include of local_settings.php) we have the following:
As I mentioned above I have added a flag to see if it even gets to this stage
And that watchdog message never gets created, which suggests that this conditional is false - as I would expect (but it obviously is TRUE, because the shutdown function is registered). However, I have tried as you suggested, changing the default value to 10, and that works. But I am reluctant to patch a contrib module for something that should work with the config I have. I can't think where the variable is being overwritten, and both drush php-eval and drush vget return the correct conf setting
When you say there might be things that shouldn't be written to cache_bootstrap-variables, can you point me in the direction of something that I can learn how to check and configure that? Because it seems googling is particularly bad, or there's very little information out there for me to tackle the issue - clearly I'm searching for the wrong thing. I would much rather fix the source than just turn off the logs!
Comment #4
Jeremy CreditAttribution: Jeremy at Tag1 Consulting commentedI'd start by moving the following line to the absolute bottom of your main
settings.php
:If that works, you can start working backwards from there to figure out where things are going wrong. For example, maybe your include is failing, or maybe it's including multiple files and a later one is overwriting things.
Or, if this doesn't solve the problem, then double check that this is the correct
settings.php
.BTW: Your watchdog test probably failed because watchdog likely isn't available at that time (which is why we're using a shutdown in the first place).
Comment #5
michaelmallett CreditAttribution: michaelmallett commentedI did consider that possibility, but I always thought watchdog was available from bootstrap.
I tried putting it at the bottom of settings.php, and no joy. The memcache module is picking up the memcache server details fine, and all the other memcache conf settings, so I can't figure out why this is not picking up this one variable.
Comment #6
Jeremy CreditAttribution: Jeremy at Tag1 Consulting commentedDepending on your web server setup, it's also possible you'll need to reload (or restart) your web server to get it to see your new
settings.php
configuration.Comment #7
michaelmallett CreditAttribution: michaelmallett commentedI've been restarting apache and php-fpm on every code push. I was thinking that it is possible that the domain access include was interfering with this, but every related issue I find has shown that placing domain access last, AFTER everything else is the solution to any issues. Either way I'm confused I can't see why it would still pick up all the other memcache conf variables in my local_settings include, and have the correct value when outputting to drush vget. I'll have to keep looking into exactly what domain access is doing with the conf array.
Also, can you elaborate on this please?
Comment #8
michaelmallett CreditAttribution: michaelmallett commentedI'm still getting this error, I've gone through and completely disabled domain access and it still ignores/overwrites the variable, and only this variable.
I've tried tweaking the cache bins, which took me a while to find anything useful with regards to. Either way, it hasn't made a difference, there is something very odd going on with this memcache install.
For anyone else looking, there's some good information in this book if you want to check it out
http://shop.oreilly.com/product/0636920012269.do
The mere existence of this module causes errors on other servers, despite it not being enabled. I get a lot of these:
In drush. The registry has been rebuilt, nothing in the settings pointing to memcache.inc, nothing in 'cache_backends', and caches cleared over and over.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedGetting this same problem, anyone have any updates?
Comment #10
Jeremy CreditAttribution: Jeremy at Tag1 Consulting commentedSorry, I'm unable to duplicate. It seems you have a misconfiguration -- the errors you're reporting suggest you've enabled memcache in settings.php, but haven't installed a required PECL extension.
Comment #12
Unnikrishnan.K CreditAttribution: Unnikrishnan.K as a volunteer and commentedHello,
yes, solved by adding $conf['memcache_log_data_pieces'] = 10; on settings.php on memcache configuration
Comment #13
StephenRobinson CreditAttribution: StephenRobinson commentedI got a few of these when testing with PHP7. If you are seeing this often, you probably need to delete your unused variables, a project like https://www.drupal.org/project/variable_clean can help....