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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rohnjeynolds created an issue. See original summary.

rohnjeynolds’s picture

Here's a patch that resolves this issue for our use case.

badrange’s picture

Status: Active » Needs review

Setting status to needs review since there is a patch.

pifagor’s picture

Status: Needs review » Reviewed & tested by the community

+1 for this! RTBC by me.

yonailo’s picture

+1 for me also

pifagor’s picture

  • pifagor committed dc29311 on 7.x-2.x authored by rohnjeynolds
    Issue #2851552 by rohnjeynolds, pifagor, badrange, unknownguy: On...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

jweowu’s picture

This 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().