Closed (fixed)
Project:
Workbench Access
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Jun 2011 at 23:13 UTC
Updated:
1 Feb 2013 at 22:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mirzu commentedfixed this was due to having xdebug enabled locally and had nothing to do with this module.
Comment #2
Anonymous (not verified) commentedI have the same issue with the "nesting level of '100' reched" error. But disabling or enabling xdebug has no impact. It occured the first time after I changed some Workbench Access related permission settings.
The error is somewhere in the callstack of the "menu_workbench_access_tree" Function. If I prevent drupal from executing that function the error is gone. (see a screenshot of the callstack attached).
When I'm logged in as user 1, the error doesn't occur.
Comment #3
Anonymous (not verified) commentedComment #4
agentrickardworkbench_access_get_active_tree()should only be called once per page request, unless you are saving data or callingworkbench_access_reset_tree().There is a very dumb typo in the static check.
Comment #5
agentrickardBumping to critical. This is rare but showstopping.
Comment #6
Anonymous (not verified) commentedThe patch doesn't solve the problem yet.
During the first call $active is null, so isset($active['access_scheme']) is false --> correct so far. Now the second time when the function is executed, $active has the following structure:
So isset($active['access_scheme']) is still false. I guess the condition should be something like:
That actually works out for me... but I'm not sure if the availability of 'access_scheme' should be explicitly checked.
Comment #7
agentrickardThat doesn't make sense to me. $active should never return a numeric keyed array. The structure should be:
So the question is this:
1) Why is your structure different?
2) Why can I not reproduce that structure?
I wonder if it's because the call is erroring out. That's what it looks like. I can only replicate that data structure if I do this:
There may be an issue with the re-assignment of the $active variable, so let's try changing that.
Tests pass for this patch, so if it fails fo you, we really need to dig in to what's wrong with your install.
Comment #8
Anonymous (not verified) commentedWhat I found out is that the numeric keyed array for $active is only returned as anonymous user. As soon as I log in as user 1, the array has the structure as you are expecting it.
Renaming the variable from $active to $access_tree didn't help.
I use the module for a prototype so my drupal installation is quite clean --> only workbench and modules like panels or views are installed.
The error happened the first time, when I manipulated the permissions for the workbench module (right after saving). You find the permissions I've set in the attachment. Maybe you can reproduce it with that.
Comment #9
agentrickardThanks!
Comment #10
agentrickardComment #11
agentrickardNope. Cannot replicate. I wonder if it has to do with how Panels is calling the page.
Your original stack trace looked like a Panels page call. Does it occur on all pages or just Panels pages?
Can you export and attach the panels page?
Comment #12
agentrickardNeeds more info, actually, since I cannot replicate without hacking the code.
Comment #13
agentrickardI'm going to commit the obvious fix. Then we can dig into your issue.
Comment #14
Anonymous (not verified) commentedOk, I tried to replicate the problem on a clean new drupal 7.4 installation with the latest versions of panels, views, workbench, workbench access, etc...!
The error did not occur (not with panel pages, not with contexts or anything ...). So I think we mark this as fixed until someone else has a similar problem and is able to replicate it.
Thanks for your help!!
Comment #15
agentrickardSure. We did find a nasty and dumb bug!
Comment #17
jhedstromI'm seeing this on a site running 1.0 (and changing to latest dev doesn't resolve). Attached is relevant portion of the stack trace. Basically,
workbench_access_get_active_tree()is recursively calling itself when there is no cache. The issue first started when somebody was saving a node. Specifically, the call toworkbench_access_tree()from withinworkbench_access_get_active_tree()is causing the recursion.Comment #18
agentrickardExact steps to replicate, please.
Comment #19
jhedstromI still haven't yet figured out how the system got into this state, but I've traced the issue to calls to
workbench_access_tree()from withinworkbench_access_get_active_tree(). The site is using the menu scheme for access, so this function then callsmenu_workbench_access_tree(), which in turn callsmenu_tree_all_data(), which callsmenu_build_tree(), which then calls back toworkbench_access_get_active_tree().I'll provide more information as I find it.
Comment #20
agentrickardWhat are you doing when this happens?
Comment #21
jhedstromOk, I've traced this back to an essentially recursive link placed in the menu system.
There was a top-level main menu link to
node/11, and another link under that pointing tonode/11/1. Removing the latter resolved the issue.I can reproduce this on a stock D7 site running workbench access by putting such a recursive node link into the main menu.
Comment #22
agentrickardEek. Not sure we can do much about that.
Comment #23
jhedstromYeah, I don't have any immediate ideas on how to get around that, which is unfortunate since this user-error has the power to take down the entire site, with the only fix being some forensics work and the manual removal of the offending link.
Comment #24
agentrickardWe might be able to do some checking in _workbench_menu_build_tree() to ensure that we don't load the same data twice. Perhaps something like so?
But that shouldn't be the issue, since node/11 and node/11/1 should have different mlids. I don't really see how this loop occurs.
Comment #25
agentrickardDoes your fatal error call stack ever get to that function?
Comment #26
jhedstromIt doesn't appear to ever reach
_workbench_access_menu_build_tree().Comment #27
larowlanWe experienced this issue and traced it down to an additional trailing / on a menu entry.
Fixed with:
Comment #28
larowlanI can confirm that editing a menu link and adding a / to the end of it causes this issue.
Comment #29
agentrickardWell, adding a '/' is user error.
Comment #30
larowlanYes agreed, pity menu system doesn't catch it as an invalid path :(
Comment #31
agentrickardYou should file (or find) an issue for that. That's a UX fail.
Comment #32
larowlanimo it's a feature, not a fail.
I've always used trailing args on menu items to facilitate alternate page tpls.
Eg page-node-lightbox.tpl.php has no sidebars etc.
Then links to /node/3/lightbox load with a different page tpl to /node/3
But I agree, the issue is not with workbench_access
Comment #33
jhedstromThe problem though is that with just core, the user error can be fixed easily, or ignored. With workbench access enabled, the site fatal errors until the offending path is manually removed from the db.
Comment #34
agentrickardI am open to fixing this loophole here, if we can figure out how.
Comment #35
leszek.stachowski commentedThis is how I manage to reproduce this error:
Comment #36
agentrickardWhen I follow those steps and clear the cache, if the first page load comes from an anon user, I am getting a page timeout.
Comment #37
agentrickardThere is a race condition in menu_workbench_access_tree() that only appears when certain types of items are placed in the menu. If menu_tree_all_data() has not yet primed the cache, we hit an infinite loop.
Comment #38
agentrickardTracked it down.
Two changes in this patch, which tests cleanly with both "node/1/" and "node/add" as "bad" menu items.
I'm not crazy about using a "private" function, but it seems to be stable.
Comment #39
agentrickardI suspect that this works by bypassing the access check in menu_tree_build(). My concern is that we also bypass translation and may need to call _menu_link_translate().
Comment #40
agentrickardWith menu testing in, this can be reproduced, I believe, by adding 'node/add' into the menu structure test.
The remaining question is whether the solution is proper.
Comment #41
Sean Buscay commentedI have tested the latest patch by first reproducing the error and then applying the patch to fix the error.
The error is fixed correctly.
I confirmed the menu items continue to follow the correct access scheme based on permissions.
I will test the translation issue and then this should be ready to be committed.
Comment #42
agentrickardComment #44
agentrickardRe-roll of original patch.
Comment #45
agentrickardInteresting. The patch in #42 fails without the patch in #44, and perhaps that is a sufficient test condition.
I am replicating the steps in #35.
This patch, which combines #42 and #44 passes.
So the remaining question is simply: Can we safely call the "private" function here?
Comment #46
agentrickardOK, thanks to @stevector and @Sean Buscay, we were able to replicate this in the test.
Comment #47
agentrickardTestbot is stalled. This patch is green. Committing.
Comment #48
agentrickard