After upgrading Rules from 2.6 to 2.9 on a site with both Rules and Scheduler enabled, I am getting the error with stacktrace below when drush attempts to clear the cache after running another module's update hooks. The update went fine, and the steps to reproduce are: "drush cc; drush updb;" after the updb completes it tries to clear the cache then throws this error. I wonder if the issue may be that the plugins are not loaded when rules is invoked via this route, so it is failing, but I don't know enough about this module's organization.

Apologies for the long paste, it doesn't feel quite long enough to warrant a text file upload.

exception 'ReflectionException' with message 'Function rules_data_list_info_alter() does not exist' in                                       [error]
/var/www/site.drupal.dev/docroot/sites/all/modules/contrib/rules/includes/rules.core.inc:1808
Stack trace:
#0 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/rules/includes/rules.core.inc(1808):
ReflectionFunction->__construct('rules_data_list...')
#1 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/rules/includes/rules.core.inc(1726):
RulesAbstractPlugin->getFileName('rules_data_list...', Array)
#2 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/rules/rules.module(424): RulesAbstractPlugin->rebuildCache(Array,
Array)
#3 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/rules/rules.module(383): _rules_rebuild_cache(Array)
#4 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/rules/rules.module(664): rules_get_cache()
#5 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/rules/rules.module(128): rules_plugin_factory('reaction rule')
#6 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/scheduler/scheduler.rules_defaults.inc(20): rules_reaction_rule()
#7 [internal function]: scheduler_default_rules_configuration()
#8 /var/www/site.drupal.dev/docroot/includes/module.inc(866): call_user_func_array('scheduler_defau...', Array)
#9 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/entity/entity.module(875): module_invoke('scheduler',
'default_rules_c...')
#10 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/entity/entity.module(853): _entity_defaults_rebuild('rules_config')
#11 /var/www/site.drupal.dev/docroot/sites/all/modules/contrib/entity/entity.module(1080): entity_defaults_rebuild()
#12 [internal function]: entity_flush_caches()
#13 /var/www/site.drupal.dev/docroot/includes/module.inc(895): call_user_func_array('entity_flush_ca...', Array)
#14 /var/www/site.drupal.dev/docroot/includes/common.inc(7545): module_invoke_all('flush_caches')
#15 /usr/local/share/drush/commands/core/drupal/cache.inc(90): drupal_flush_all_caches()
#16 /usr/local/share/drush/includes/drush.inc(700): drush_cache_clear_both()
#17 /usr/local/share/drush/includes/drush.inc(687): drush_call_user_func_array('drush_cache_cle...', Array)
#18 /usr/local/share/drush/commands/core/cache.drush.inc(143): drush_op('drush_cache_cle...')
#19 [internal function]: drush_cache_command_clear('all')
#20 /usr/local/share/drush/includes/command.inc(359): call_user_func_array('drush_cache_com...', Array)
#21 /usr/local/share/drush/includes/command.inc(210): _drush_invoke_hooks(Array, Array)
#22 [internal function]: drush_command('all')
#23 /usr/local/share/drush/includes/command.inc(178): call_user_func_array('drush_command', Array)
#24 /usr/local/share/drush/lib/Drush/Boot/DrupalBoot.php(46): drush_dispatch(Array)
#25 /usr/local/share/drush/drush.php(74): Drush\Boot\DrupalBoot->bootstrap_and_dispatch()
#26 /usr/local/share/drush/drush.php(11): drush_main()
#27 {main}

Comments

duntuk’s picture

If possible, disable and uninstall rules module... Doing so will fix this.

martinpe’s picture

Having the same problem.

Man the rules module sure has bugs.

And no, disable + uninstall is no option when so many other modules are depending on it.

Find a solution.

sheldon rampton’s picture

Version: 7.x-2.9 » 7.x-2.x-dev
StatusFileSize
new450 bytes

Here's a patch that fixed the issue for me.

kenorb’s picture

Status: Active » Needs review
geek-merlin’s picture

Component: Scheduler » Rules Core
Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Raising prio as this causes a wsod on cache clears.
Setting RTBC as this looks reasonable and fixes the issue for me.

Here's a trace for further analysis.


exception 'ReflectionException' with message 'Function       [error]
rules_data_list_info_alter() does not exist' in
/var/www/virtual/renner/html/development/code/sites/all/modules/rules/includes/rules.core.inc:1811
Stack trace:
#0 /var/www/virtual/renner/html/development/code/sites/all/modules/rules/includes/rules.core.inc(1811):
ReflectionFunction->__construct('rules_data_list...')
#1 /var/www/virtual/renner/html/development/code/sites/all/modules/rules/includes/rules.core.inc(1726):
RulesAbstractPlugin->getFileName('rules_data_list...', Array)
#2 /var/www/virtual/renner/html/development/code/sites/all/modules/rules/rules.module(423):
RulesAbstractPlugin->rebuildCache(Array, Array)
#3 /var/www/virtual/renner/html/development/code/sites/all/modules/rules/rules.module(382): _rules_rebuild_cache(Array)
#4 /var/www/virtual/renner/html/development/code/sites/all/modules/rules/rules.module(1636): rules_get_cache()
#5 [internal function]: rules_token_info()
#6 /var/www/virtual/renner/html/development/code/includes/module.inc(895): call_user_func_array('rules_token_inf...',
Array)
#7 /var/www/virtual/renner/html/development/code/includes/token.inc(260): module_invoke_all('token_info')
#8 /var/www/virtual/renner/html/development/code/sites/all/modules/token/token.module(507): token_info()
#9 /var/www/virtual/renner/html/development/code/sites/all/modules/entity/entity_token.tokens.inc(176): token_get_info()
#10 [internal function]: entity_token_tokens('file', Array, Array, Array)
#11 /var/www/virtual/renner/html/development/code/includes/module.inc(895): call_user_func_array('entity_token_to...',
Array)
#12 /var/www/virtual/renner/html/development/code/includes/token.inc(178): module_invoke_all('tokens', 'file', Array,
Array, Array)
#13 /var/www/virtual/renner/html/development/code/includes/token.inc(87): token_generate('file', Array, Array, Array)
#14 /var/www/virtual/renner/html/development/code/sites/all/modules/file_entity/file_entity.file.inc(198):
token_replace('[file:field_fil...', Array, Array)
#15 [internal function]: file_entity_file_load(Array)
#16 /var/www/virtual/renner/html/development/code/includes/entity.inc(368): call_user_func_array('file_entity_fil...',
Array)
#17 /var/www/virtual/renner/html/development/code/sites/all/modules/entitycache/entitycache.module(108):
DrupalDefaultEntityController->attachLoad(Array, false)
#18 /var/www/virtual/renner/html/development/code/sites/all/modules/entitycache/entitycache.module(191):
EntityCacheControllerHelper::entityCacheLoad(Object(EntityCacheDefaultEntityController), Array, Array)
#19 /var/www/virtual/renner/html/development/code/includes/common.inc(7927):
EntityCacheDefaultEntityController->load(Array, Array)
#20 /var/www/virtual/renner/html/development/code/includes/file.inc(565): entity_load('file', Array, Array)
#21 /var/www/virtual/renner/html/development/code/modules/file/file.field.inc(181): file_load_multiple(Array)
#22 /var/www/virtual/renner/html/development/code/modules/field/field.attach.inc(344): file_field_load('bean', Array,
Array, Array, 'und', Array, 'FIELD_LOAD_CURR...', NULL)
#23 /var/www/virtual/renner/html/development/code/modules/field/field.attach.inc(714): _field_invoke_multiple('load',
'bean', Array, 'FIELD_LOAD_CURR...', NULL, Array)
#24 /var/www/virtual/renner/html/development/code/sites/all/modules/entity/includes/entity.controller.inc(840):
field_attach_load('bean', Array)
#25 /var/www/virtual/renner/html/development/code/sites/all/modules/bean/includes/bean.core.inc(469):
EntityAPIControllerExportable->attachLoad(Array, false)
#26 /var/www/virtual/renner/html/development/code/sites/all/modules/entity/includes/entity.controller.inc(281):
BeanEntityAPIController->attachLoad(Array, false)
#27 /var/www/virtual/renner/html/development/code/sites/all/modules/entity/includes/entity.controller.inc(730):
EntityAPIController->load(Array, Array)
#28 /var/www/virtual/renner/html/development/code/includes/common.inc(7927): EntityAPIControllerExportable->load(Array,
Array)
#29 /var/www/virtual/renner/html/development/code/sites/all/modules/bean/bean.module(609): entity_load('bean', Array,
Array, false)
#30 /var/www/virtual/renner/html/development/code/sites/all/modules/bean/bean.module(516): bean_load_multiple(Array)
#31 /var/www/virtual/renner/html/development/code/sites/all/modules/bean/bean.module(855): bean_get_all_beans()
#32 [internal function]: bean_block_info()
#33 /var/www/virtual/renner/html/development/code/includes/module.inc(866): call_user_func_array('bean_block_info', Array)
#34 /var/www/virtual/renner/html/development/code/modules/block/block.module(388): module_invoke('bean', 'block_info')
#35 /var/www/virtual/renner/html/development/code/modules/block/block.module(985): _block_rehash('bartik')
#36 [internal function]: block_flush_caches()
#37 /var/www/virtual/renner/html/development/code/includes/module.inc(895): call_user_func_array('block_flush_cac...',
Array)
#38 /var/www/virtual/renner/html/development/code/includes/common.inc(7600): module_invoke_all('flush_caches')
#39 /home/renner/.composer/vendor/drush/drush/commands/core/drupal/cache.inc(90): drupal_flush_all_caches()
#40 /home/renner/.composer/vendor/drush/drush/includes/drush.inc(700): drush_cache_clear_both()
#41 /home/renner/.composer/vendor/drush/drush/includes/drush.inc(687): drush_call_user_func_array('drush_cache_cle...',
Array)
#42 /home/renner/.composer/vendor/drush/drush/commands/core/cache.drush.inc(143): drush_op('drush_cache_cle...')
#43 [internal function]: drush_cache_command_clear('all')
#44 /home/renner/.composer/vendor/drush/drush/includes/command.inc(359): call_user_func_array('drush_cache_com...', Array)
#45 /home/renner/.composer/vendor/drush/drush/includes/command.inc(210): _drush_invoke_hooks(Array, Array)
#46 [internal function]: drush_command('all')
#47 /home/renner/.composer/vendor/drush/drush/includes/command.inc(178): call_user_func_array('drush_command', Array)
#48 /home/renner/.composer/vendor/drush/drush/lib/Drush/Boot/DrupalBoot.php(46): drush_dispatch(Array)
#49 /home/renner/.composer/vendor/drush/drush/drush.php(74): Drush\Boot\DrupalBoot->bootstrap_and_dispatch()
#50 /home/renner/.composer/vendor/drush/drush/drush.php(11): drush_main()
#51 {main}
casaran’s picture

The patch from #3 worked for me.

br0ken’s picture

Number of dirname() with the same argument start increasing.

joelpittet’s picture

I guess it could be dirname(__DIR__) and save one if that helps @BR0kEN?

br0ken’s picture

@joelpittet it's not critical - that's why I haven't changed issue status. Of course it will not give us tangible performance boost, but it's just a good practice to not execute functions more than once with a single set of arguments.

I think __DIR__ cannot be used since Drupal 7 has declared 5.2 as minimum version of PHP and the rules module has no definition of php inside its *.info file which means it's operability works within 5.2 as well. The constant exists starting from 5.3.

For instance, we can create a variable, use it and unset it afterward.

Besides of that, I don't like increasing number of includes. There's a @todo which assumes module's contributors are going to remove them at all relying on Drupal registry but I can assure that this will lead to errors on existing sites and this issue is a confirmation of what I'm saying.

Probably we need to consider the usage of https://www.drupal.org/project/autoload or https://www.drupal.org/project/registry_autoload.

joelpittet’s picture

Oh yeah I forgot __DIR__ was 5.3 and we expect >= 5.2.5

fago’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

This issue has not got much comments, what makes me think that not many people have that problem. Thus, I don't think it warants adding a hacky workaround like that.