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.
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();
}
Comments
Comment #1
yhahn CreditAttribution: yhahn commentedOut 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.
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedeconomist.com is still on a bastard variant of beta1. we'll upgrade to b4 and and add more info as needed. thanks yhahn.
Comment #3
hefox CreditAttribution: hefox commentedMarked #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.)
Comment #4
volkerk CreditAttribution: volkerk commentedported to 7.x
Comment #5
volkerk CreditAttribution: volkerk commentedadded trailing spaces (ported to 7.x)
Comment #6
hefox CreditAttribution: hefox commentedComment #7
mpotter CreditAttribution: mpotter commentedI 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.
Comment #8
bojanz CreditAttribution: bojanz commentedI think the hook needs to be removed completely. See #1572578: Rethink the way features are enabled / disabled for an alternative approach proposal.
Comment #9
MiSc CreditAttribution: MiSc commentedHad to rewrite the patch to work with drupal standard.
Comment #10
xtfer CreditAttribution: xtfer commentedUpdated 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.
Comment #11
helmo CreditAttribution: helmo commentedI'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 ...
Comment #12
xtfer CreditAttribution: xtfer commentedNo, it won't fix that issue, so they may not be dupe's.
Comment #13
Paul B CreditAttribution: Paul B commentedThe 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.
Comment #14
ianthomas_ukReroll of #10 against 7.x-2.0-dev
Comment #15
hefox CreditAttribution: hefox commentedThis isn't needed anymore since the tab exists now
Comment #16
hefox CreditAttribution: hefox commentedComment #17
mpotter CreditAttribution: mpotter commentedComment #18
hefox CreditAttribution: hefox commentedcommited to 7.x-2.x
Comment #19
hefox CreditAttribution: hefox commented#3: 658772_features_rebuild_on_flush.patch queued for re-testing.
Comment #20
james.williams CreditAttribution: james.williams commentedThank 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.
Comment #21
acbramley CreditAttribution: acbramley commentedPatch for 6.x-1.x, also going to create one for #1153028: menu_links_features_export_options() dies with too many items.
Comment #22
acbramley CreditAttribution: acbramley commentedHere's a patch to apply if you apply the one from #1153028: menu_links_features_export_options() dies with too many items. first
Comment #23
davidwbarratt CreditAttribution: davidwbarratt at Golf Channel commentedIf you need the hook removed in 7.x-1.x, you could use hook_module_implements_alter() to remove the hook implementation. :)
Comment #25
kenorb CreditAttribution: kenorb commentedMost likely backport to 6.x won't happen, therefore marking as fixed.
Comment #26
kenorb CreditAttribution: kenorb commented