When using exported configuration on installation - directly in an install profile or indirectly in a hook_enable() - caches may need to be cleared to make sure that all exported objects are available. This is usually done by invoking ctools_export_load_object_reset(). Under certain circumstances this is not enough, as this method clears internal caches in ctools_export_load_object() and ctools_export_load_object_all() but not in functions that they rely on: _ctools_export_get_defaults() and ctools_plugin_api_info().

Patch coming.

CommentFileSizeAuthor
#1 716288-1_clear_caches.patch2.05 KBalex_b

Comments

alex_b’s picture

Assigned: alex_b » Unassigned
Status: Active » Needs review
StatusFileSize
new2.05 KB

Replaces internal static caches in _ctools_export_get_defaults() and ctools_plugin_api_info() with ctools_static() and updates ctools_export_load_object_reset() accordingly.

Applies to 1.3, should also apply to DRUPAL-6--1.

yhahn’s picture

I can confirm that this patch does what it claims it does. It's turning out to be important in all things deployment & testing related.

merlinofchaos’s picture

Version: 6.x-1.3 » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Committed. Needs to be done for 7.x too.

pounard’s picture

Status: Patch (to be ported) » Needs work

Sorry to disturb, but when applying this patch, at cache rebuild time I got fatal errors on require_once. I'm currently using Drupal 6.16 / ctools 1.3, this patch, PHP 5.3.1 on fedora, APC cache active.

The error is inconsistent, it may be a PHP bug, it does try to require_once the same file twice. But the fact is the bug can only be reproduced (and is reproduced systematically) as soon as I use this patch.

[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP Fatal error:  Cannot redeclare ctools_custom_content_type_render() (previously declared in /var/www/drupal-installation-profiles/testing/modules/contrib/ctools/plugins/content_types/custom/custom.inc:38) in /var/www/drupal-installation-profiles/testing/modules/contrib/ctools/plugins/content_types/custom/custom.inc on line 51, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   1. {main}() /var/www/test.triage/www/index.php:0, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   2. theme() /var/www/test.triage/www/index.php:36, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   3. init_theme() /var/www/test.triage/www/includes/theme.inc:606, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   4. _init_theme() /var/www/test.triage/www/includes/theme.inc:59, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   5. _theme_load_registry() /var/www/test.triage/www/includes/theme.inc:179, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   6. _theme_build_registry() /var/www/test.triage/www/includes/theme.inc:225, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   7. _theme_process_registry() /var/www/test.triage/www/includes/theme.inc:421, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   8. ctools_theme() /var/www/test.triage/www/includes/theme.inc:266, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP   9. _ctools_passthrough() /var/www/drupal-installation-profiles/testing/modules/contrib/ctools/ctools.module:304, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP  10. ctools_content_theme() /var/www/drupal-installation-profiles/testing/modules/contrib/ctools/ctools.module:243, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP  11. ctools_get_content_types() /var/www/drupal-installation-profiles/testing/modules/contrib/ctools/includes/content.theme.inc:16, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP  12. ctools_get_plugins() /var/www/drupal-installation-profiles/testing/modules/contrib/ctools/includes/content.inc:114, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
[Tue Mar 23 14:19:34 2010] [error] [client 127.0.0.1] PHP  13. ctools_plugin_load_includes() /var/www/drupal-installation-profiles/testing/modules/contrib/ctools/includes/plugins.inc:185, referer: http://test.triage.guinevere/install.php?locale=&profile=testing
yhahn’s picture

Did you restart your HTTP server after patching? This happens to me sometimes with a PHP opcode cache (I use xcache) -- it appears to get confused about the state of the files it has cached.

pounard’s picture

I did try yes, I'll do more test tomorow. But looking at the execution stack, could not find what was really disturbing PHP (or APC). Some require_once are called up to 10 times at cache rebuild time! Not easy to know which one really disturbs the others.

I already saw this kind of bugs because of special undisplayed chars in the code, it can be really fatal to PHP sometime. I'll try to look this way.

merlinofchaos’s picture

Status: Needs work » Fixed

I'm pretty sure we've taken care of this.

pounard’s picture

That is a rather old issue, never experienced this bug again since.

Status: Fixed » Closed (fixed)

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