Download & Extend

menu_tree_all_data() static cache can become stale

Project:Drupal core
Version:6.x-dev
Component:menu system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:Newbie

Issue Summary

Yet another static cache problem. This time, the menu tree can become stale when inserting multiple book pages in a single request. As the menu tree is stale, children of children can't be inserted:

Example:

Parent
-- Child
-- Child

works but

Parent
-- Child
--- Child

will fail on the last page.

Patches are forthcoming. This affects Drupal 6 as well.

Comments

#1

Status:active» needs review

Here are patches for 6.x and 7.x. Any suggestions for appropriate test cases? I could just verify that the cache is accurate after adding menu items, but that seems a little simple.

Also, I currently reset the cache in menu_rebuild(), and then leave it up to the calling code to call menu_rebuild(). I'm guessing that book.module should call that somewhere (it doesn't), but I think that should be a seperate patch as it probably occurs in other modules as well.

AttachmentSizeStatusTest resultOperations
364529_menu_tree_all_data_cache_6.x.patch1.34 KBIdleFailed: Failed to install HEAD.View details | Re-test
364529_menu_tree_all_data_cache_7.x.patch1.32 KBIdleFailed: Failed to install HEAD.View details | Re-test

#2

I ran into this problem with my custom module in Drupal 6. The suggested patch fixes my problem, so I hereby vote to have it in the next Drupal 6 release.

#3

Status:needs review» needs work

The last submitted patch failed testing.

#4

Version:7.x-dev» 6.x-dev
Status:needs work» needs review

This has been dealt with in HEAD over at #422368: convert menu.inc to use new static caching API.

Anyone feel like giving the patch against 6.x another review?

#5

I simply added manually the change to the head, the last patch won't add everything.

AttachmentSizeStatusTest resultOperations
364529_menu_tree_all_data_cache_6.x.patch1.33 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 364529_menu_tree_all_data_cache_6.x_0.patch.View details | Re-test

#6

Re-roll looks good; don't want to RTBC it as I created it, but I'm marking as a newbie-friendly patch as it's a fairly simple and clear change.

#7

Here is a reroll to sync against DRUPAL-6.

AttachmentSizeStatusTest resultOperations
364529_menu_tree_all_data_cache_6.x_7.patch1.39 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 364529_menu_tree_all_data_cache_6.x_7.patch.View details | Re-test

#8

Status:needs review» needs work

The last submitted patch, 364529_menu_tree_all_data_cache_6.x_7.patch, failed testing.

nobody click here