Recent updates breaks our sites with a fatal error. The ctools/includes/plugins.inc is trying to include a plugin file that got removed with the latest oembed update (file plugins/export_ui/oembed_preset.inc)

ctools 7.x-1.2
oembed 7.x-0.1.beta3

[Wed Sep 05 15:49:36 2012] [error] [client 152.23.170.31] PHP Fatal error: require_once(): Failed opening required '/Library/WebServer/Documents/drupal7/sites/all/modules/oembed/plugins/export_ui/oembed_preset.inc' (include_path='.:/php/includes:/usr/lib/php/Zend/library') in /Library/WebServer/Documents/drupal7/sites/all/modules/ctools/includes/plugins.inc on line 475

Files: 
CommentFileSizeAuthor
#15 ctoots_file_loading_error.txt12.68 MBpwaterz
#3 plugin-load-use-include-1775612-3.patch603 bytesbartram
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]
#2 1775612-calling-missing-file-2.patch1.26 KBianthomas_uk
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Comments

merlinofchaos’s picture

This should be fixed with a cache clear.

ianthomas_uk’s picture

Status:Active» Needs review
StatusFileSize
new1.26 KB
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

A cache clear would fix this, but if you're getting a white screen of death then you may not be able to clear your cache, even using Drush.

If we throw an exception instead of letting PHP trigger a fatal error then this will be caught by the default exception handler and you'll be able to clear the cache with Drush. It also gives other modules the chance to handle this error themselves (e.g. hiding the block that the ctools plugin is used in, but showing the rest of the page).

I've attached an example patch of how this could work, as I didn't want to waste time on a complete patch if it would not be accepted. Worth noting is that this patch only catches one of at least two instances of require_once that we'd want to handle, and it uses PHP's generic Exception class rather than a more specific exception. I'd be happy to make these changes if such a patch would be accepted (any suggestions for what Exception should be thrown?).

Drupal 8 core plugins already throw exceptions, but the messages are being improved in https://drupal.org/node/1897762 and https://drupal.org/node/1846070

bartram’s picture

StatusFileSize
new603 bytes
PASSED: [[SimpleTest]]: [MySQL] 121 pass(es).
[ View ]

This issue also occurs for me when switching between branches on other modules, where one branch has defined a plugin, and the other branch is a few commits behind. When switch back to the old branch, I get the WSOD, and I am unable to clear my cache, even with Drush.
Is there a reason for using 'require_once' instead of 'include_once'? It's not the end of the world if the file doesn't exist, but 'require_once' acts like it is. The function name ('ctools_plugin_load_includes') suggests that the module should use 'include_once'.
Here's a patch. If the file goes missing, I can still clear my cache, and ignore any errors that show up.

John Bickar’s picture

I ran into this when moving module files around (from a subdirectory in "profiles" into sites/all/modules).

Truncating the cache table manually allowed me to clear the cache with drush:

drush sqlq 'truncate table cache'
DamienMcKenna’s picture

Version:7.x-1.2» 7.x-1.x-dev
Issue summary:View changes

pwiniacki’s picture

got this when updating commerce _shipping module from version x.1 to version x.2:

Fatal error: require_once() [function.require]:
Failed opening required '/home/sites/all/modules/commerce_shipping/plugins/quotes/quote_base/quote_base.inc'
(include_path='.:/usr/local/php/p53/lib/php') in /home/sites/all/modules/ctools/includes/plugins.inc on line 475

So just clearing cache fix this issue?

EDIT: related - https://www.drupal.org/node/1332476

DamienMcKenna’s picture

@pwiniacki: Please heck with the commerce_shipping module, there should be some documentation on how to update from one version to another.

pwiniacki’s picture

@DamienMcKenna thanks, I already did before making any post here. On my localhost everything is fine, on live I get error above.

EDIT: I did try to update my live site again - no error this time. But error appear on my localhost test page :) So I guess this will be very hard to target - random error :P

DamienMcKenna’s picture

@pwiniacki: I mention that because your issue has nothing to do with this issue in CTools, you really should open a new "support request" issue for Commerce Shipping.

pwiniacki’s picture

@DamienMcKenna ok got it, thanks for you support, every help is appreciated.

Anyway If somebody got similar problem - when you disable rule Commerce Shipping Example plugin
Machine name: commerce_shipping_example_plugin

your chance to upgrade without error are higher but this error can still randomly appear.

pwaterz’s picture

I have ran into the same issue multiple times when deploying code updates. We use Capistrano for deploying code and it change the directory structure on every deploy. I run into a php error every time when it tries to load the plugins. Also running drush cc all does not fix it for me. I have to manually clear the cache table independently to get this to go away. It seems as if there is a race condition happening when a cache clear happens and when ctools loads plugins.

pwaterz’s picture

Here is a backtrace I get when trying to clear the cache via drush

0] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/ctools/includes/plugins.inc
            [line] => 276
            [function] => ctools_plugin_load_includes
        )

    [1] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views_ctools_field/views_ctools_field.module
            [line] => 126
            [function] => ctools_get_plugins
        )

    [2] => Array
        (
            [function] => views_ctools_field_views_data
        )

    [3] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/module.inc
            [line] => 895
            [function] => call_user_func_array
        )

    [4] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/includes/cache.inc
            [line] => 90
            [function] => module_invoke_all
        )

    [5] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/includes/cache.inc
            [line] => 37
            [function] => _views_fetch_data_build
        )

    [6] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/views.module
            [line] => 1280
            [function] => _views_fetch_data
        )

    [7] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/views.module
            [line] => 1616
            [function] => views_fetch_data
        )

    [8] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/includes/view.inc
            [line] => 617
            [function] => views_move_table
        )

    [9] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/includes/view.inc
            [line] => 672
            [function] => fix_missing_relationships
            [class] => view
            [type] => ->
        )

    [10] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/plugins/views_plugin_display_page.inc
            [line] => 60
            [function] => init_handlers
            [class] => view
            [type] => ->
        )

    [11] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/includes/view.inc
            [line] => 1456
            [function] => execute_hook_menu
            [class] => views_plugin_display_page
            [type] => ->
        )

    [12] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/sites/all/modules/contrib/views/views.module
            [line] => 400
            [function] => execute_hook_menu
            [class] => view
            [type] => ->
        )

    [13] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/module.inc
            [line] => 1101
            [function] => views_menu_alter
        )

    [14] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/menu.inc
            [line] => 2762
            [function] => drupal_alter
        )

    [15] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/menu.inc
            [line] => 2722
            [function] => menu_router_build
        )

    [16] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/menu.inc
            [line] => 459
            [function] => menu_rebuild
        )

    [17] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/menu.inc
            [line] => 1755
            [function] => menu_get_item
        )

    [18] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/menu.inc
            [line] => 1770
            [function] => menu_get_custom_theme
        )

    [19] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/common.inc
            [line] => 5219
            [function] => menu_set_custom_theme
        )

    [20] => Array
        (
            [file] => /opt/sites/jnl-jbjsam/drupal-webroot/releases/20150611175424/includes/bootstrap.inc
            [line] => 2280
            [function] => _drupal_bootstrap_full
        )

    [21] => Array
        (
            [file] => /opt/drupal/releases/20150609212016/drush/includes/bootstrap.inc
            [line] => 930
            [function] => drupal_bootstrap
        )

    [22] => Array
        (
            [file] => /opt/drupal/releases/20150609212016/drush/includes/bootstrap.inc
            [line] => 185
            [function] => _drush_bootstrap_drupal_full
        )

    [23] => Array
        (
            [file] => /opt/drupal/releases/20150609212016/drush/includes/bootstrap.inc
            [line] => 345
            [function] => drush_bootstrap
        )

    [24] => Array
        (
            [file] => /opt/drupal/releases/20150609212016/drush/includes/bootstrap.inc
            [line] => 291
            [function] => drush_bootstrap_max
        )

    [25] => Array
        (
            [file] => /opt/drupal/releases/20150609212016/drush/drush.php
            [line] => 81
            [function] => drush_bootstrap_to_phase
        )

    [26] => Array
        (
            [file] => /opt/drupal/releases/20150609212016/drush/drush.php
            [line] => 61
            [function] => _drush_bootstrap_and_dispatch
        )

    [27] => Array
        (
            [file] => /opt/drupal/releases/20150609212016/drush/drush.php
            [line] => 16
            [function] => drush_main
        )

)

DamienMcKenna’s picture

@pwaterz: if you could include the arguments from the first few items we might be able to get an idea of what plugin is misbehaving.

pwaterz’s picture

StatusFileSize
new12.68 MB

Full backtrace

pwaterz’s picture

This looks like it's actually a bug with view. Cache clear is calling menu rebuild, which then view is altering the menu callbacks and loading plugins. When really the plugin cache should have been cleared before views tried to load the plugins.

pwaterz’s picture

I should note this is happening even when I try to run
drush php-eval 'cache_clear_all("*", "cache", TRUE)'

I think is happening because the menu cache got cleared and now during boostrap it is attempting to rebuild the menu cache, but it can't because views is accessing a stale ctools plugin cache.

pwaterz’s picture

I think patch #3 is the way to go

extraextraspezial’s picture

patch #3 solved it for me too!