menu_router unreliable during rebuild
First, feel free to correct if I am mistaken about my understanding of how menu_router and the rebuild process works.
I think this is related to #251792: Implement a locking framework for long operations and #246653: Duplicate entry in menu_router: Different symptoms, same issue in the sense that the menu_router_rebuild process should generally be locked to prevent two processes from rebuilding at the same time.
When menu_router gets rebuilt, it seems to enter into an unreliable state (after the DELETE from {menu_router} and before all of the router inserts are finished). If anyone loads the site during this time, there seems to be no mechanism to prevent them from querying a menu_router table that is not ready. I.e., if you ask for admin/blah/path/module, that particular router entry may not exist yet, so you may get the menu entry for admn/blah instead, or maybe nothing at all.
This is probably not a problem for a small blog, but for a high-traffic website, a rebuild window of even 1s is too big to not be noticed by someone.
The ideal situation would be that the READs from the table would be locked against WRITEs. I attempted wrapping those queries inside of SQL locks to see if that would help, and in practice this was way too slow -- seemed to just result in a lot of processes waiting for locks to clear whenever a rebuild happened.
Pete Stein