Hello,

We upgraded to version 1.9 this morning in our Continuous Integration System at work and there is small problem when running the updb in drush.

Here is the log:

The following updates are pending:

 memcache_admin module            
 6001 - description not available 


Do you wish to run all pending updates? (y/n): y
The external command could not be executed due to an application error.                                                                                                         [error]
Executing memcache_admin_update_6001                                                                                                                                            [success]
Drush command terminated abnormally due to an unrecoverable error.                                                                                                              [error]
Error: Call to undefined function dmemcache_object() in
/opt/drupal-ci/drupal-core-websmals/sites/integration.websmals.smals-mvm.be/modules/contrib/memcache/memcache_admin/memcache_admin.module, line 416
Output from failed command :                                                                                                                                                    [error]
 
Fatal error: Call to undefined function dmemcache_object() in
/opt/drupal-ci/drupal-core-websmals/sites/integration.websmals.smals-mvm.be/modules/contrib/memcache/memcache_admin/memcache_admin.module on line 416

Call Stack:
    0.0012     184896   1. {main}() /opt/drush-4.4/drush.php:0
    0.0233    2889544   2. drush_main() /opt/drush-4.4/drush.php:41
    0.2062    9800240   3. drush_dispatch() /opt/drush-4.4/drush.php:101
    0.2064    9801136   4. call_user_func_array() /opt/drush-4.4/includes/command.inc:204
    0.2064    9801664   5. drush_command() /opt/drush-4.4/includes/command.inc:0
    0.2071    9809304   6. call_user_func_array() /opt/drush-4.4/includes/command.inc:721
    0.2071    9809536   7. drush_invoke() /opt/drush-4.4/includes/command.inc:0
    0.2074    9810096   8. drush_invoke_args() /opt/drush-4.4/includes/command.inc:58
    0.2079    9827232   9. call_user_func_array() /opt/drush-4.4/includes/command.inc:120
    0.2079    9827784  10. drush_core_updatedb_batch_process() /opt/drush-4.4/includes/command.inc:0
    0.2098   10031008  11. _update_batch_command() /opt/drush-4.4/commands/core/core.drush.inc:699
    1.0748   48104632  12. drush_batch_command() /opt/drush-4.4/commands/core/drupal/update_6.inc:502
    1.0764   48168856  13. _drush_batch_command() /opt/drush-4.4/includes/batch.inc:68
    1.0767   48174616  14. _drush_batch_worker() /opt/drush-4.4/commands/core/drupal/batch_6.inc:75
    1.0767   48177264  15. call_user_func_array() /opt/drush-4.4/commands/core/drupal/batch_6.inc:109
    1.0767   48177512  16. _update_do_one() /opt/drush-4.4/commands/core/drupal/batch_6.inc:0
    1.0768   48179272  17. memcache_admin_update_6001() /opt/drush-4.4/commands/core/drupal/update_6.inc:484
    1.0768   48179272  18. drupal_flush_all_caches()
/opt/drupal-ci/drupal-core-websmals/sites/integration.websmals.smals-mvm.be/modules/contrib/memcache/memcache_admin/memcache_admin.install:33
    1.0784   48179272  19. menu_rebuild() /opt/drupal-ci/drupal-core-websmals/includes/common.inc:3809
    1.0787   48179856  20. menu_router_build() /opt/drupal-ci/drupal-core-websmals/includes/menu.inc:1702
    1.1002   49687480  21. call_user_func() /opt/drupal-ci/drupal-core-websmals/includes/menu.inc:1729
    1.1002   49687720  22. memcache_admin_menu() /opt/drupal-ci/drupal-core-websmals/includes/menu.inc:0
    1.1003   49697624  23. memcache_admin_stats_types()
/opt/drupal-ci/drupal-core-websmals/sites/integration.websmals.smals-mvm.be/modules/contrib/memcache/memcache_admin/memcache_admin.module:79

A simple solution could be to include that line:

module_load_include('inc', 'memcache', 'dmemcache');

On the top the of memcache_admin.module but I don't know if it's better to put it there OR to put it in the needed function (memcache_admin_stats_type()) on line 411.

Anyway, I provide the 2 patches, can you tell me what's the best thing to do in that case ?

Comments

pol’s picture

pol’s picture

My latest patches failed to apply in Jenkins, probably because of the a and b added in front of the files.

I reroll the files without those front directory (see issue http://drupal.org/node/1110430).

m.stenta’s picture

Priority: Normal » Major

First patch fixes that error when you're installing, but doesn't fix it when you go to /admin/reports/memcache

Second patch fixes both. Not sure if it needs to be loaded all the time like that, though... ? Didn't look into it too deeply... thanks for the patch though.

m.stenta’s picture

Scratch that. Second patch does not work when you're logged out. Oy...

m.stenta’s picture

Clarification: The error originally happens for me when installing memcache_admin module.

pol’s picture

Hello m.stenta,

I'll work again on it on Monday, by the time, keep sending me feedback, I'll provide a new patch if needed!
I wonder if it's not a dependency problem from memcache_admin.

I'll check it out on Monday, first hours, because I don't have the time this week end to touch a computer :(

See you!

m.stenta’s picture

OK, well I figured out what was causing the problem on my machine: http://drupal.org/node/1147672

Pol: if you have the APC PECL module installed, try uninstalling it:

sudo pecl uninstall apc

(and also delete the "extension=apc.so" from php.ini (or from /etc/php5/conf.d/apc.ini if that's where it is).

That solved the problem for me. If it solves it for you too, then this issue can be closed as a duplicate of http://drupal.org/node/1147672.

alippai’s picture

I get this error without APC. So I don't think it's a duplicate.

pol’s picture

Hello guys,

I made further tests and I cannot reproduce the error once the first patch in #2 is applied.

Can you provide more feedback about it ?

Thanks !

scroogie’s picture

I can confirm that the patch in #2 worked for me as well on memcache 1.9.

CarbonPig’s picture

I can also confirm that the first patch in #2 worked for me. I was getting this error when trying to run "clear all caches"

Thanks,

http://carbonpig.com

catch’s picture

Status: Active » Needs review
scroogie’s picture

Catch, does this really need additional review? It's just a module_load_include() for using the dmemcache_object(), which is called in the update.

catch’s picture

@scroogie I marked it as needs review because I keep forgetting there's a patch here.

Additionally you should never use module_load_include() unless you can be certain you're in full bootstrap, although the 2.1 version of the patch looks OK from that, so will probably commit that next time I'm looking at this.

jim kirkpatrick’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #2 allowed me to install and use the module, marking as such.

pol’s picture

Hello @Jim,

Which version of the patch ? the 2.1 or the 2.2 ?

jim kirkpatrick’s picture

@Pol: erm, both... !

I figured belt and braces is best... Obviously for an actual patch one or other is better.

catch’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed the 2.1 patch from #2 - http://drupalcode.org/project/memcache.git/commit/079afbd

Thanks!

Marking 'to be ported' since similar may be needed in the 7.x branch.

psynaptic’s picture

I'm getting a similar error using 6.x-1.x:

Fatal error: Call to undefined function dmemcache_stats() in /home/api/domains/api.freestylesystems.co.uk/public_html/sites/all/modules/memcache/memcache_admin/memcache_admin.module on line 230

Seems like this needs another module_load_include.

monotaga’s picture

psynaptic's patch in #19 works for me on 6.x-1.x-dev (1 July 2011). It seems like a goofy thing to have been omitted.

catch’s picture

Committed to 6.x-1.x branch, leaving as to be ported for 7.x.

danny englander’s picture

I had this same issue, the first one in #2 worked for me. (Drupal 6.22)

catch’s picture

Status: Patch (to be ported) » Fixed

The code path has changed a fair bit in D7, marking this one fixed for now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Version: 7.x-1.x-dev » 7.x-1.0-rc2
Status: Closed (fixed) » Active

Having this error while running update.php on 7.x-1-rc2

 Fatal error: Call to undefined function dmemcache_object() in sites\all\modules\contrib\memcache\memcache_admin\memcache_admin.module on line 418
Anonymous’s picture

That function is in dmemcache.inc, including that file fixes the problem

function memcache_admin_stats_types($bin) {
  module_load_include('inc', 'memcache', 'dmemcache');
  if ($mc = dmemcache_object($bin)) {
tcmug’s picture

jahsh’s picture

We Committed the 2.1 patch from #2 with drupal Version: 6.x-1.x-dev and it fixed our issue as well.

catch’s picture

Status: Active » Closed (duplicate)
nicholasthompson’s picture

I found this happened if the settings.php didn't include the appropriate memcache configuration. This is just for reference for anyone else experiencing this bug.

zuernbernhard’s picture

Exactly ! These lines in the config (sites/default/settings.php) made my day:

$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

Thank you !

deanflory’s picture

Here's what I put into settings.php based on the latest README instructions:

/**
 * Memcached (server), memcache (server), memcache module (Drupal)
 */
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE

Pretty clear documentation here:
https://www.drupal.org/node/1131468

I ended up getting a WSOD from that, so I removed the last two lines which brought my site back:

$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE