The #658772: Provide way to disable rebuild during features_flush_caches() ticket has provided a way for features rebuilding to be avoided on clearing the cache. Features are also rebuilt on the admin/modules page though (explicitly done by features_form_system_modules_alter(), it's not because of a cache clear), which has been mentioned on that ticket & its duplicates before.
If there is now the setting to disable rebuilding on clearing the cache, why not do the same (ideally, just re-use the same setting and rename it?) for rebuilding on the /admin/modules page?
It is very possible to get into situations where the modules page cannot be reached because of fatal errors in features. I found this when I had conflicting field definitions, but I couldn't get to the modules page to sort that out.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

I'm experiencing this problem as well. On our Drupal Commons site, Features executes a shocking 3,757 queries. After commenting out the features_rebuild() line, it drops to 332. Admittedly, we probably have other issues here with features_rebuild() requiring so many queries, but combined with the general overhead of the modules page (parsing all the .info files), rebuilding features on the modules page puts our server over the top.

quicksketch’s picture

As a work-around, we're currently disabling Features' hook_form_alter() with this:

/**
 * Implements hook_module_implements_alter().
 */
function site_helper_module_implements_alter(&$implementations, $hook) {
  // TODO: Hack until https://drupal.org/node/2036935 is fixed.
  // Remove the features_rebuild() call on the modules page.
  if ($hook === 'form_system_modules_alter') {
    if (array_key_exists('features', $implementations)) {
      unset($implementations['features']);
    }
  }
}
momchil_brashnyanov’s picture

I'm adding a patch with implementation similar to the one for rebuilding features when flushing the cache.

MiroslavBanov’s picture

Status: Active » Needs review
mpotter’s picture

That features_form_system_modules_alter hook is so specific it makes me wonder what the original purpose for doing this was. I looked at the code and this line comes from the original commit of Features was back in 2009. So there isn't any comment or issue to tell us why this was needed.

Maybe it goes back to something in D6 or older Features that isn't needed anymore.

Unlike the Flush case, I'm tempted to make the default value be False instead of True so that it doesn't rebuild on the Module page. I honestly wasn't even aware it was doing that and it explains why the module page is so slow sometimes.

Since I just did the 2.8 release I'm not going to rush out another release for this so we have time to discuss it. Interested in others opinions, especially if anybody can think of a reason why this rebuild on the modules page is even necessary.

MiroslavBanov’s picture

From what I know about software development and first commits, I would guess there never was a reason for the hook.

Scenario one:
Developer knows he needs to rebuild features in some situations, but is unsure when, so he takes a guess and doesn't validate the guess.

Scenario two:
Developer is resolving an actual problem, tries a couple of things, one of them works, he gets distracted with something else, both changes stay.

Status: Needs review » Needs work

The last submitted patch, 3: rebuild-features-config-2036935-3.patch, failed testing.

The last submitted patch, 3: rebuild-features-config-2036935-3.patch, failed testing.

mpotter’s picture

Status: Needs work » Needs review
FileSize
1.41 KB

Here is a version that defaults to FALSE.

mpotter’s picture

Status: Needs review » Reviewed & tested by the community

  • mpotter committed 430d3ca on 7.x-2.x authored by MiroslavBanov
    Issue #2036935 by mpotter, momchil_brashnyanov, MiroslavBanov: Provide...
mpotter’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 430d3ca.

Status: Fixed » Closed (fixed)

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