I propose that we remove features_flush_caches(). This gets called during every cron run its features_rebuild() leads to various cache clears from fieldgroup and other cck caches. The effects of cache clears like these is magnified when using memcache's cache.inc which must empty a whole bin.

Do we really need this hook implementation? I can't think of a reason we want to rebuild during regular site operation such as hook_cron(). Rebuild should be administrator initiated using a form or update function, IMO.

Here is the hook implementation

function features_flush_caches() {
  features_rebuild();
  features_get_modules(NULL, TRUE);
  return array();
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yhahn’s picture

Out of curiosity are the rebuilds in question getting logged to watchdog? The rebuild process was rewritten in beta4, so it should only actually run rebuild scripts (e.g. the CCK ones) when there are actual changes to push out. If no component changes are present no actual rebuilding (and subsequently cache clearing) should occur.

If they are occurring and there aren't changes we've got a bug on our hands.

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

economist.com is still on a bastard variant of beta1. we'll upgrade to b4 and and add more info as needed. thanks yhahn.

hefox’s picture

Title: Too much cache clearing due to features_flush_caches() » Provide way to disable rebuild during features_flush_caches()
Category: bug » feature
Status: Postponed (maintainer needs more info) » Needs work
FileSize
1.85 KB

Marked #658772: Provide way to disable rebuild during features_flush_caches() as duplicate.

Here's a 6.x that need to port to 7.x but don't have time atm.

It adds a variable to disable features_flush_cache

(There's various reasons to want that, for example if need to run updates before it does it.)

volkerk’s picture

ported to 7.x

volkerk’s picture

added trailing spaces (ported to 7.x)

hefox’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review
mpotter’s picture

I think this patch is very interesting, but it needs to be re-rolled against the latest 1.x-dev and be sure to create your patch from the Features module directory itself and not from your Drupal home directory.

bojanz’s picture

I think the hook needs to be removed completely. See #1572578: Rethink the way features are enabled / disabled for an alternative approach proposal.

MiSc’s picture

Had to rewrite the patch to work with drupal standard.

xtfer’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
FileSize
2.72 KB

Updated for 7.x-2.0-beta2, so it's slightly different.

Also, reworded the description on the settings page slightly so its in clearer English.

helmo’s picture

I've marked #1917288: Don't trigger features rebuild on cache clear as a duplicate of this issue.

It's angel was that opening the admin/modules pages calls features_var_export() > 100.000 times on a large site.
The patch from #10 unfortunately does not 'fix' that.

It has some cachegrind info which could be usefull here ...

xtfer’s picture

No, it won't fix that issue, so they may not be dupe's.

Paul B’s picture

The patch works for me, but is the rebuild ever necessary?

When I do a drush cc all, Features tries to update a field definition - and fails with a FieldUpdateForbiddenException in some cases.

If I read http://drupal.org/node/582680 correctly, this should not happen. I'm not trying to revert the feature, I'm trying to clear the cache.

ianthomas_uk’s picture

Reroll of #10 against 7.x-2.0-dev

hefox’s picture

Status: Needs review » Needs work
+++ b/features.module
@@ -173,6 +173,17 @@ function features_menu() {
+  $items['admin/structure/features/settings'] = array(
+    'title' => 'Settings',
+    'description' => 'Set advanced settings for features module.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('features_settings_form'),
+    'access callback' => 'user_access',
+    'access arguments' => array('administer features'),
+    'type' => MENU_LOCAL_TASK,
+    'file' => 'features.admin.inc',
+    'weight' => 15,

This isn't needed anymore since the tab exists now

hefox’s picture

Status: Needs work » Needs review
FileSize
1.41 KB
mpotter’s picture

Status: Needs review » Reviewed & tested by the community
hefox’s picture

Version: 7.x-2.x-dev » 6.x-1.x-dev
Status: Reviewed & tested by the community » Needs review

commited to 7.x-2.x

hefox’s picture

james.williams’s picture

Thank you for committing this!!

As has been mentioned before on this ticket (and its duplicates), rebuilding also occurs when hitting the /admin/modules page (and that's not from a cache clear, it's done explicitly in a form_alter hook) -- I believe this setting ought to be extended/replicated to disable that too, so I've opened #2036935: Provide way to disable rebuilding features on admin/modules page.

acbramley’s picture

acbramley’s picture

davidwbarratt’s picture

If you need the hook removed in 7.x-1.x, you could use hook_module_implements_alter() to remove the hook implementation. :)

  • hefox committed 487af98 on 8.x-3.x
    Issue #658772 by hefox, ianmthomasuk, xtfer, MiSc, volkerk: Provide way...
kenorb’s picture

Version: 6.x-1.x-dev » 8.x-3.x-dev
Status: Needs review » Fixed

Most likely backport to 6.x won't happen, therefore marking as fixed.

kenorb’s picture

Version: 8.x-3.x-dev » 7.x-2.x-dev

Status: Fixed » Closed (fixed)

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