Problem/Motivation
There seems to be an edge case in which the plugin information can become inconsistent.
The scenario is as follows:
- Fetch plugin information using
ctools_get_plugins()
- Plugin info cache is hit - so
ctools_plugin_load_includes()
isn't triggered - Plugin class loaded using
ctools_plugin_get_class()
- this includes the plugin file usingrequire_once()
! - Plugin info cache (including static) is flushed
- Fetch plugin information using
ctools_get_plugins()
- Plugin info cache not hit so
ctools_plugin_load_includes()
is triggered, but it can't re-include the previously included plugin file. So no plugin info available. The incomplete plugin info is cached.
This turns out to be fatal e.g. when using panelizer. Panelizer isn't able to load the handler, which means no panelizer property is set to the entities loaded - and those entities can be cached in the entitycache. So even if the plugin info cache is re-built, the impact is still there and can screw up quite some stuff ;)
Proposed resolution
I suggest to "outsource" the plugin arrays handling done by ctools_plugin_load_includes()
to a dedicated function that only takes care of including files and keep track of the plugin arrays.
This newly introduced function is used where ever the plugin file is included:
ctools_plugin_load_includes()
ctools_plugin_get_function()
ctools_plugin_get_class()
The only function I'm not sure about is ctools_plugin_api_include()
, haven't analysed it in-depth.
Remaining tasks
Reviews needed.
User interface changes
None.
API changes
New function ctools_plugin_include_plugin_file()
which has to be used to load plugin files.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2598166.patch | 3.8 KB | djdevin |
ctools-plugin-information-inconsistent.patch | 3.82 KB | das-peter |
Comments
Comment #3
Chris CharltonJust got bit by this.
Comment #4
darrenwh CreditAttribution: darrenwh as a volunteer and at Investis Digital commentedCould you add some tests for this new function
Comment #5
djdevinJust rerolling.
Comment #6
joelpittet