On our large site, rebuilding the XML sitemap via 'drush xmlsitemap-rebuild' exhausts the 512MB of allocated memory. Debugging led us to the function xmlsitemap_node_xmlsitemap_process_node_links(), which is called repeatedly during the rebuild batch process, and which calls node_load_multiple() without resetting the node static cache. When we changed the node_load_multiple() call by passing TRUE as third argument, rebuild was able to complete without error.
I'll submit a patch with this change. Some cursory exploration leads us to believe that resetting the node static cache is safe and appropriate. First, it seems xmlsitemap_node_xmlsitemap_process_node_links() is only called when the sitemap data is rebuilt via drush. Second, it seems unlikely that the same node would be loaded twice during a rebuild batch operation.
Comment | File | Size | Author |
---|---|---|---|
#2 | xmlsitemap-node-static-cache-reset-2851552-2.patch | 631 bytes | rohnjeynolds |
|
Comments
Comment #2
rohnjeynolds CreditAttribution: rohnjeynolds at Meredith Corporation commentedHere's a patch that resolves this issue for our use case.
Comment #3
badrange CreditAttribution: badrange at Digia commentedSetting status to needs review since there is a patch.
Comment #4
pifagor+1 for this! RTBC by me.
Comment #5
yonailo CreditAttribution: yonailo as a volunteer commented+1 for me also
Comment #6
pifagorComment #8
pifagorComment #10
jweowu CreditAttribution: jweowu at Catalyst IT commentedThis wasn't a good change -- that $reset flag should be completely avoided in Drupal 7. And in any case, this change merely reduced the chance of exceeding memory limits -- with an arbitrarily large $nids argument, that
node_load_multiple()
could still do exactly that.Please review #2986733: Don't use $reset flag with node_load().