Dear Dev-Team,
i had some cache issues in the node edit form, since the last weeks. I spend already few hours of live debugging, to figure out why the megatag values in the form are still the default ones. The module Entitycache had a old version of the node cached in the table cache_entity_node without the already updated metatag infos, even if they are saved in the metatag configuration successfully. I'm still wondering why the node edit form will display cached data and not the original one from the database, but i like to inform you about this issue. It may be related to your last beta release in January 2014.

Finally, i disabled the other module to solve the problem, so there is actually nothing to do for you - excepting a compatibility check. This reference may help other users experiencing similar issues.

Kind regards,
R. Volk

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna’s picture

Status: Needs review » Closed (works as designed)

I've been using EntityCache on my sites with the -dev release without any problems. Have you experienced any specific problems?

Poieo’s picture

I had this same issue, but it was Commerce Entity Cache that was causing the defaults to display when editing a node. I don't think this has anything to do with the Entity Cache module.

Poieo’s picture

Status: Closed (works as designed) » Active

I'm going to redact my previous comment. I did in fact have to turn off entity cache as well to get the meta tags working again.

In my case, I am using core revisions, entity cache, and metatags together. Everything saves fine and even displays in the source code just fine. However, in what appears to be random incidences, when editing a node the metatag defaults display instead of the actual data from database.

I'm not sure if it is an Entity Cache or Metatag issue.

budnyjj’s picture

I also had the same issue.

In my case, all custom descriptions have disappeared. After turning off entitycache it have appeared again.

Sorry for my english.

rvolk’s picture

Can anyone of you reproduce the behavior? The problem occurred only randomly on our live system, not at the staging system with activated caching - so it is really hard to reverse engineer it. Fact is, the edit form will continue loading the wrong data from the entity cache, until the cache was cleared. I guess the Metatag module is just one of many who would suffer from this behavior, but can anybody locate the problem so that we could find a solution and continue using both modules?

Does anyone have also problems with other modules inheriting from the entity cache?

Looking forward for a bug reproduction.

vimaljoseph’s picture

I also face the same issue with metatags and entitycache.

We use metatag 7.x-1.0-beta9 and entitycache 7.x-1.2 with redis cache backend.

To reproduce it in our environment:

1) Add metatags to a node and save it. The meta tag will appear properly in the system, even when editing the node.
2) Clear cache.
3) The metatag added will be removed. When edit the node, it show default for metatag fields.

When entitycache module is disabled, the metatags works perfectly.

roberttstephens’s picture

I'm running into the same issue using entitycache 7.x-1.2 and the latest metatag dev release.

metatags works by using hook_entity_load(). I found that after clearing cache through drush (drush cc all), the metatags would not get loaded onto a node.

metatag_entity_load() calls metatag_entity_supports_metatags(), but metatag_entity_supports_metatags() was returning false.

metatag_entity_supports_metatags() calls entity_get_info() and caches the $entity_types array. The first time that metatag_entity_supports_metatags() calls entity_get_info(), it is returning what seems to be the wrong data. Subsequent calls to metatag_entity_supports_metatags() returned false, since $entity_types was already cached using drupal_static().

Disabling entitycache "fixes" the issue. A workaround to use both modules would be NOT statically caching $entity_types the first time, but that seems ugly.

Curiously, this problem doesn't exist on some other sites using both entitycache and metatag.

DamienMcKenna’s picture

@robertstephens: Oh, good sleuthing! Thanks!

DamienMcKenna’s picture

Version: 7.x-1.0-beta9 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
1.23 KB

Just playing with ideas here, but does this resolve the problem?

vimaljoseph’s picture

Thanks for the patch, but sorry, it does not resolve the issue.

I face the same issue now. I tried the following:

1) Disable entitycache module
2) Created a node with metatags
3) Clear cache (drush cc all) - the meta tags were there in the node.
4) Apply patch to the metatags module
5) Enabled entitycache (the meta tags were still there, when I view or edit node)
6) Clear cache (drush cc all) (The node shows "using default" in metatag - Also when I first reload the node edit page, the metatags tab was not there, I had to reload the page again to get the metatag tab.)
7) Disabled entitycache (the correct metatag values shown when reload the node edit page after disabling the entitycache module)

DamienMcKenna’s picture

Status: Needs review » Needs work

sadpanda.

DamienMcKenna’s picture

Status: Needs work » Postponed (maintainer needs more info)

I ran through the scenario detailed in #10 with the latest -dev release of both Entity and EntityCache but couldn't reproduce the error. Might another module be interfering with this?

johnle’s picture

I was working on the same site as roberttstephens. I was running into this issue with the drupal forums enabled. In the metatag.module, I've commented out the lines in metatag_entity_info_alter().

 //if (module_exists('forum') && ($revision_id = variable_get('forum_nav_vocabulary', 0)) && $vocabulary = taxonomy_vocabulary_load($revision_id)) {
  //  $defaults['taxonomy_term']['bundles'][$vocabulary->machine_name]['path'] = 'forum/%taxonomy_term';
  //}

I've tested this with entity cache enabled and everything seems to work. Maybe the get_entity_info() has something to do with the function taxonomy_vocabulary_load running and caching the info array.

DamienMcKenna’s picture

Title: Entitycache incompatibility? » Entitycache incompatibility with core forums & Metatag
Status: Postponed (maintainer needs more info) » Active

@johnle: Excellent research, that greatly helps narrow things down. Thanks.

roberttstephens’s picture

+1 to johnle figuring this out. The difference between our sites that have this issue and don't have this issue is whether or not they have forums. I'm confirming that commenting out the code above fixes the issue.

It looks like it's just determining which vid is used for the forums. Could taxonomy_vocabulary_load($revision_id) be replaced with a db_select?

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
939 bytes

BTW did you notice the minor copy/paste typoo? "revision_id"? I guess I missed that one when I went whole-hog replacing $vid with $revision_id. :-)

Does tis fix the problem?

johnle’s picture

I apply the patch for #16 and it seems to work perfectly.

Thanks!!

  • DamienMcKenna committed e1bce27 on 7.x-1.x
    Issue #2227377 by DamienMcKenna: taxonomy_vocabulary_load() caused...
DamienMcKenna’s picture

Status: Needs review » Fixed

Committed! I tweaked the comment a little bit, just to explain the rationale for the custom query. Thanks for helping to debug the problem.

rvolk’s picture

That was a great response to this issue since i wrote the bug report end of March. Many thanks for everyone who helped to narrow this bug down. The patch solved the issue with the "forum" module, but my site doesn't use this module at all. There must be another part which will influence this issue, don't you think so?

I will try to test the current patches soon as possible on my site, to give you early feedback.

Thanks a lot!

DamienMcKenna’s picture

@R.Volk: Oh dear :( Well, please give the latest -dev release a spin and let us know if the problem persists. Thanks.

Status: Fixed » Closed (fixed)

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