Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using PHP 5.3.6 I get the following notices on the statistics page:
Notice: Undefined index: incr_hits in _memcache_admin_stats_counters() (line 168 of /var/www/dev/drupal/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: incr_misses in _memcache_admin_stats_counters() (line 168 of /var/www/dev/drupal/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: decr_hits in _memcache_admin_stats_counters() (line 168 of /var/www/dev/drupal/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: decr_misses in _memcache_admin_stats_counters() (line 168 of /var/www/dev/drupal/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: incr_hits in _memcache_admin_stats_counters() (line 168 of /var/www/dev/drupal/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: incr_misses in _memcache_admin_stats_counters() (line 168 of /var/www/dev/drupal/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: decr_hits in _memcache_admin_stats_counters() (line 168 of /var/www/dev/drupal/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: decr_misses in _memcache_admin_stats_counters() (line 168 of /var/www/dev/drupal/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Comments
Comment #1
millwardesque CreditAttribution: millwardesque commentedI'm seeing this in PHP 5.2.11 as well.
Comment #2
christowm CreditAttribution: christowm commentedHi folks,
I am getting the same error. Here are my environment stats:
Ubuntu Linux 10.04
memcached 1.0.2
Pressflow 6.22
Memcached package 1.4.5-1ubuntu2
Memcache Module 6.x-1.9
The error message that I get when I access the memcache report is:
Notice: Undefined index: incr_hits in _memcache_admin_stats_counters() (line 160 of /home/quickstart/websites/demo.dev/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: incr_misses in _memcache_admin_stats_counters() (line 160 of /home/quickstart/websites/demo.dev/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: decr_hits in _memcache_admin_stats_counters() (line 160 of /home/quickstart/websites/demo.dev/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: decr_misses in _memcache_admin_stats_counters() (line 160 of /home/quickstart/websites/demo.dev/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: incr_hits in _memcache_admin_stats_counters() (line 160 of /home/quickstart/websites/demo.dev/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: incr_misses in _memcache_admin_stats_counters() (line 160 of /home/quickstart/websites/demo.dev/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: decr_hits in _memcache_admin_stats_counters() (line 160 of /home/quickstart/websites/demo.dev/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Notice: Undefined index: decr_misses in _memcache_admin_stats_counters() (line 160 of /home/quickstart/websites/demo.dev/sites/all/modules/memcache/memcache_admin/memcache_admin.module).
Hopefully someone can figure out why this is happening.
Cheers,
Mitch
Comment #3
tonylegrone CreditAttribution: tonylegrone commentedI have this problem in d7 as well. I've only been learning about memcached for the last 5 days. So I'm not sure how to truly fix the problem at the source, but I did alter the function to stop the notices.
That takes care of the notices, but it doesn't solve the problem that the indexes are undefined in the first place.
Comment #4
Robin Millette CreditAttribution: Robin Millette commentedI had the same notices with php5-memcached (debian lenny package) but using the php5-memcache package fixed those warnings.
Can you confirm if you are using the memcache PECL or the memcached one?
Comment #5
tonylegrone CreditAttribution: tonylegrone commentedI had the notices while using PECL memcached 1.0.2 and php 5.3.6.
Comment #6
EdgarPE CreditAttribution: EdgarPE commentedSame, as comment #4.
The notices only appear with php5-memcached package (version 1.0.0). With php5-memcache package (v. 3.0.4) there is no problem.
Edit: Drupal memcache module version: 7.x-1.0
Comment #7
Konstantin Boyandin CreditAttribution: Konstantin Boyandin commentedConfirming the same problem, Drupal 7.12, PHP 5.3.10, the latest PECL memcached (2.0.1)
Sorry, wrong Drupal version - but it seems the problem has the same origin.
Comment #8
pgrond CreditAttribution: pgrond commentedSame for me PECL memcached (v1.0.2) and Drupal 7.13
Comment #9
brianV CreditAttribution: brianV commentedMarked #1517086: Undefined index notices on memcache stats page and #1558648: Undefined index notices, for v7.x-1.x-dev + Drupal 7.14 as dupes.
Manarth in http://drupal.org/node/1517086#comment-6365978 points out:
Comment #10
InternetDevels CreditAttribution: InternetDevels commentedPatch for notices fixing.
Comment #11
InternetDevels CreditAttribution: InternetDevels commentedchanged status
Comment #12
brianV CreditAttribution: brianV commentedSeems like a good patch; however, if the stats are not available, maybe a message should be set on the page indicating that the stats can not be fetched?
Without some kind of on-page documentation, users may sit there wondering why their memcache looks like it's not working at all!
Comment #13
InternetDevels CreditAttribution: InternetDevels commentedHere is updated patch which informs user about statistic fetching may be disabled.
Comment #14
FluxSauce CreditAttribution: FluxSauce commentedPatch in #13 stated incorrect reason for the stats not showing; PECL Memcached getStats() doesn't support increment and decrement statistics as pointed out in #9. Additionally, the use of drupal_set_message was a bit extreme (FYI, the third option is repeat, so no need for the static).
Recreated patch to provide contextually appropriate information (if server is up and the stats are missing, assume PECL Memcached and show message) and adhered to Drupal coding standards.
Side note, memcache_admin.module has Windows line endings; that should be corrected at some point.
Comment #15
InternetDevels CreditAttribution: InternetDevels commented@FluxSauce
I agree with comment above. But your patch has a little mistake. In t() function "!incr" placeholder replaced incorrectly - $decrements variable is using instead of $increments.
Comment #16
InternetDevels CreditAttribution: InternetDevels commentedHere is patch fixing mistake above:
Comment #17
Sam MooreThanks for the patch in #16.
This not only fixed the error message, but also cleared a bug whereby the statistics were appearing twice on a page, when the "Show Memcache Statistics" box was checked, and once when it wasn't (!).
Oddly none of this happened on one of my other sites, hosted on the same codebase...
Comment #18
FluxSauce CreditAttribution: FluxSauce commented@InternetDevels.Com HAH, good catch. Teamwork!
Comment #19
FluxSauce CreditAttribution: FluxSauce commentedTo maintainers: request dual commit credit with InternetDevels.Com on this fix.
Comment #20
brianV CreditAttribution: brianV commented+1 on this patch
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commentedCan please a maintainer push the patch to master? Thanks!
Comment #22
fgmThe current patch assumes that the lack of incr/decr implies use of PECL memcached, but this can also happen simply because the counters are really zero, not because this version of that extension is used and they have been set to 0 by the code.
How about removing this assumption and using a simpler patch ?
Comment #23
markpavlitski CreditAttribution: markpavlitski commentedThe patch in #22 works for both PECL extensions and seems like the most elegant solution.
Comment #24
fayedrupal CreditAttribution: fayedrupal commentedThanks for the #22 patch it work for me :-)
Comment #25
Jeremy CreditAttribution: Jeremy commentedCommitted #22 -- thanks!
http://drupalcode.org/project/memcache.git/commit/a878c95
Needs to be ported to 6.x.
Comment #26
Jeremy CreditAttribution: Jeremy commentedCommitted to 6.x-1.x:
http://drupalcode.org/project/memcache.git/commit/9d55237