Details
Description
Odd out-of-memory error when I try to look at a single Maling report. The stack crawl looks like this:
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 51632 bytes) in /home/production/sites/demdata_v2/drupal/sites/all/modules/civicrm/packages/DB/DataObject.php on line 0
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP Stack trace:
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 1.
() /home/production/sites/demdata_v2/drupal/index.php:0
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 2. menu_execute_active_handler() /home/production/sites/demdata_v2/drupal/index.php:21
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 3. call_user_func_array() /home/production/sites/demdata_v2/drupal/includes/menu.inc:516
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 4. civicrm_invoke() /home/production/sites/demdata_v2/drupal/includes/menu.inc:516
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 5. CRM_Core_Invoke::invoke() /home/production/sites/demdata_v2/drupal/sites/all/modules/civicrm/drupal/civicrm.module:482
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 6. CRM_Mailing_Page_Report->run() /home/production/sites/demdata_v2/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php:246
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 7. CRM_Core_Page_Basic->run() /home/production/sites/demdata_v2/drupal/sites/all/modules/civicrm/CRM/Mailing/Page/Report.php:120
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 8. CRM_Core_Page_Basic->browse() /home/production/sites/demdata_v2/drupal/sites/all/modules/civicrm/CRM/Core/Page/Basic.php:178
[Wed Mar 06 20:58:30 2013] [error] [client 127.0.0.1] PHP 9. DB_DataObject->fetch() /home/production/sites/demdata_v2/drupal/sites/all/modules/civicrm/CRM/Core/Page/Basic.php:240
As near as I can tell, the problem here is that in CRM_Core_Page_Basic->browse() , it looks as if rather than just loading the currently mailing, the code is loading EVERY SINGLE MAILING KNOWN TO THE SYSTEM. And this system has something like 15K mailings in the system. The fetch() loop at CRM/Core/Page/Basic.php:240 just keeps pulling 'em in, until the system dies.
You may ask why there are 15K mailings in this system (mostly, it's because they want to keep the opt-out info, which is linked to the Mailing record in an unbreakable chain). It's a fair question. But a better question is why a browse for a single item is causing 15K unneeded records to load.
Have not been able to look at the 4.3-based trunk yet, but since I haven't seen this issue raised anywhere, figured I'd ask.