On a few occasions my customer has had issues with the admin menu showing duplicate items or with the menu items showing in an unorthodox structure. We'd been unable to pin down the issue, and it was often (but not always) resolved using the "Wipe and rebuild" capability. Trying to track down this inconsistency, I noticed that the wipe and rebuild are separate operations, where the wipe deletes the entries in menu_links but only sets a flag for the rebuild.
The rebuild operation occurs on the next load of the admin menu. If multiple admin users (or at least users with access to admin_menu) are using the site, then the rebuild call can lead to duplicate entries.
I've put together a crude patch that clears the flag to rebuild before doing the rebuild, so that the rebuild will only be called once. It's not ideal since it doesn't address all of the potential concurrency issues, but it does clear the flag before the longest running part of the rebuild operation to reduce the likelihood of an issue.
| Comment | File | Size | Author |
|---|---|---|---|
| delete_variable_before_rebuild.patch | 969 bytes | crdant |
Comments
Comment #1
sunThanks for trying to fix this bug! However, 6.x-1.x won't see further commits unless they are highly critical (such as security vulnerabilities, which I'm not aware of though).
That is, because 3.x, albeit a bit wonky due to a bug in Drupal 6 core, works much more reliable. All necessary improvements to make 3.x work even better in D7 have been resolved already.