I was getting a WSOD and eventually tracked it down to a unnecessarily memory greedy db_select():
Line 383 in features_menu_link_load() in features.menu.inc currently:
// If link_path was changed on an existing link, we need to find it by
// searching for link_title.
else if (isset($clean_title)) {
$links = db_select('menu_links')
->fields('menu_links', array('menu_name', 'mlid', 'plid', 'link_path', 'router_path', 'link_title', 'options', 'module', 'hidden', 'external', 'has_children', 'expanded', 'weight'))
->condition('menu_name', $menu_name)
->execute()
->fetchAllAssoc('mlid');
should be changed to only load the needed fields:
// If link_path was changed on an existing link, we need to find it by
// searching for link_title.
else if (isset($clean_title)) {
$links = db_select('menu_links')
->fields('menu_links', array('menu_name', 'mlid'))
->condition('menu_name', $menu_name)
->execute()
->fetchAllAssoc('mlid');
Admittedly this matched 802 rows in our case (this is lots and lots of menus each with lots of items and lots of sub items), but I find WSODs take hours to track down the cause since every time you put a break point, if it disappears down the white hole of a WSOD before it reaches it, you have to start again, so fixing this would be great.
I see a similar thing on line 358 which also be given the slimming treatment:
$links = db_select('menu_links')
->fields('menu_links', array('menu_name', 'mlid', 'plid', 'link_path', 'router_path', 'link_title', 'options', 'module', 'hidden', 'external', 'has_children', 'expanded', 'weight', 'customized'))
->condition('menu_name', $menu_name)
->condition('link_path', $link_path)
->execute()
->fetchAllAssoc('mlid');
Features is a great module. Thanks!
Comment | File | Size | Author |
---|---|---|---|
#4 | 2300321-menu_links-4.patch | 2.86 KB | pcambra |
Comments
Comment #1
hefox CreditAttribution: hefox commentedShould likely enable error reporting to screen on development sites
Comment #2
drupalshrek CreditAttribution: drupalshrek commentedThis is a development site with error reporting to screen enabled. Sometimes though, WSOD errors still don't show, and debugging at the coal face is the only way to go.
Comment #3
hefox CreditAttribution: hefox commentedI think there may have been a reason to load those fields, but not looking at the code atm
Comment #4
pcambraI'm having a similar issue, haven't got to the bottom of the issue but I think this would help a little.