I added a comment to a forum topic that has no menu item set and was surprised to see all the /node/add aliases as well as /messages (private messages module) in the list of URLs in watchdog. If you don't allow anonymous users to create nodes or send PMs (we don't) then none of those pages could ever be cached anyway.

Input: Array
(
    [0] => messages
    [1] => node/add
    [2] => node/add/blog
    [3] => node/add/forum
    [4] => node/add/guide
    [5] => node/add/page
    [6] => node/add/product
    [7] => node/add/story
    [node] => node/9931
    [term6] => forum/6
)

It seems it is the menu expiration code that adds them all. If I disable that in settings those sorts of URLs don't appear. The node has no menu item so it shouldn't be adding anything - maybe it is getting part of the navigation menu for the current user?

CommentFileSizeAuthor
#2 expire-default-menu-fix-1309380-2.patch1.52 KBmr.j

Comments

mr.j’s picture

Issue summary: View changes

Huh. I went looking for info on this and found my own forgotten post from years ago. This can be a serious performance killer on a site using database caching. I have nodes without a menu item that take more than 30 seconds to save with the expire menu option set to either Family or Entire Menu. It is trying to flush everything in the Navigation Menu, which has over 220 items. Disable it and the nodes will save and return in under 2 seconds.

The problem occurs because menu_nodeapi starts with a default menu name, which is the one set on /admin/build/menu/settings as the "Default menu for content". It defaults to Primary Links but for unknown reason, it was set to Navigation on the site I am seeing this issue. If the node has no menu item, menu_nodeapi goes on to create a default menu object on the node with the default menu name and a mlid of 0. Then expire.module does not check whether there is an actual real menu item set on the node, and instead just expires everything using the menu name on the node.

So all we need to do to fix this is to check if the mlid on the node->menu is greater than 0, as that will only be the case if the node has a real menu link set.

mr.j’s picture

Priority: Minor » Normal
Status: Active » Needs review
StatusFileSize
new1.52 KB

Here is a patch that fixes the issue (Drupal 6 only).

liam morland’s picture

Status: Needs review » Closed (outdated)

Drupal 6 is no longer supported. If this issue exists in Drupal 7, please reopen and provide details.