I had a hard time figuring out what made one of my Drupal installations eat up all allowed memory before returning:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 46 bytes) in D:\drupal\includes\menu.inc on line 3723

I am sure it has something to do with XML Sitemap Menu, but maybe it's not an actual bug. Allow me to explain: to reproduce the error I used a clean standard Drupal 7.15 installation with just XML Sitemap and XML Sitemap Menu enabled, plus a custom module containing only the next function:

function custommodule_url_inbound_alter($path, $original_path, $path_language) {
  drupal_valid_path($path);
}

When creating a new content type (admin/structure/types/add), the site eats up the memory and errors. Apparently drupal_valid_path() eventually triggers XML Sitemap Menu which eventually triggers hook_url_inbound_alter() again, and a loop is created.

As said, I do not know if this is an actual bug, considering these rare conditions, but still my guess is that the loop is something to prevent other users from getting stuck in...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

I don't see how this can be an xmlsitemap issue. The drupal_get_normal_path() function is what invokes the hook_url_inbound_alter() and there are 12 core functions at api.drupal.org I find that calls drupal_get_normal_path(). There are two functions in xmlsitemap that call drupal_get_normal_path but I don't find that drupal_valid_path() is involved with drupal_get_normal_path() to cause a loop. However, your use case of the hook to me appears to be invalid. For one the 1st parameter of the hook should be call by ref and you have it as call by value (i.e. it should be &$path and you have $path). More research is needed, it will be a while before I can get back to it.

-sibero-’s picture

There was the same problem. In my case, the problem was in the module subpathauto-7.x-1.3 - issue - http://drupal.org/node/1790508
Sorry for bad English.

diego21’s picture

I had same problem. I had drupal 7.15 on kubuntu 12.04, xml sitemap 7.x-2.0-rc1 and subpathauto 7.x-1.3. I couldn't add content, delete existing nodes or even flush all caches without get that error or similars ( http://drupal.stackexchange.com/questions/46293/increase-memory-limit-do... ). I tried everything: increasing memory_limit in php.ini to 700MB (my laptop only has 1024MB of RAM), increasing max_execution_time to 360s in php.ini!! (because at first it was "PHP Fatal error: Maximum execution time of 30 seconds exceeded"). But when I deleted xml sitemap from my drupal installation, all worked well again. I don't know why this happens. Thanks Imeurs.

Anonymous’s picture

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Postponed

This really isn't an xmlsitemap issue but waiting for a resolution to the core issue.

stBorchert’s picture

We provided a patch to Sub-pathauto to fix the propblem there. See https://drupal.org/node/1790508#comment-7786395 for the patch.

stBorchert’s picture

Issue summary: View changes

Small textual alteration

bucefal91’s picture

Issue summary: View changes
Status: Postponed » Needs review
FileSize
727 bytes

I am having the same trouble. In my case it was xmlsitemap_menu + og_content modules enabled.

As far as I studied the problem, it appears to me the following way:

  • By some means router table has to be rebuilt (most often after a cache clear)
  • xmlsitemap_menu_menu_link_alter() hook gets invoked as a part of the rebuild process.
  • As part of that hook, XML sitemap menu module invokes menu_link_load() on the link it alters. Keep in mind that we are still rebuilding the menu router, i.e. stuff is cold/unstable in the menu component of drupal core.
  • As a part of the menu_link_load() in a few spots the core might invoke some contrib space code. In the case of og_content module it was the to_arg_functions callback (og_content_to_arg()) which invokes menu_get_item() to get the default args.
  • Loop has closed, as we are rebuilding the menu router and fetching data on the current menu item, we are falling into router rebuild again.

I think XML sitemap menu module does need to load menu link afresh (menu_link_load()

I am attaching a patch that implements this "fuse" logic. It does dissolve my problem. I do not insist to include this patch into the module (I am not sure I'd be happy to include such thing into a module I maintain :) but at least it provides some sort of solution for all the mortals out there who "need this damn thing to work").

renatog’s picture

Status: Needs review » Reviewed & tested by the community

I applied the patch #7 and it really works well. Thank you so much for your contribution on that +1 to it

  • RenatoG committed 2f0fefd on 7.x-2.x authored by bucefal91
    Issue #1788284 by bucefal91, stBorchert, -sibero-, diego21, lmeurs,...
renatog’s picture

Category: Support request » Bug report
Status: Reviewed & tested by the community » Fixed

Moved to the dev branch

Thank you so much @bucefal91

  • RenatoG committed 90e4441 on 7.x-2.x
    Revert "Issue #1788284 by bucefal91, stBorchert, -sibero-, diego21,...
renatog’s picture

Status: Fixed » Active

Sorry team, reverted because I think that will be necessary working on tests for this