Index: includes/menu.inc
===================================================================
--- includes/menu.inc	(revision 799)
+++ includes/menu.inc	(working copy)
@@ -2287,6 +2287,10 @@
     watchdog('php', 'Menu router rebuild failed - some paths may not work correctly.', array(), WATCHDOG_ERROR);
     return array();
   }
+
+  // Avoid race condition when multiple page requests clear the menu
+  db_query('LOCK TABLE {menu_router} WRITE');
+
   // Delete the existing router since we have some data to replace it.
   db_query('DELETE FROM {menu_router}');
   // Apply inheritance rules.
@@ -2387,6 +2391,9 @@
       $item['title'], $item['title callback'], $title_arguments,
       $item['type'], $item['block callback'], $item['description'], $item['position'], $item['weight'], $item['include file']);
   }
+  // Free {menu_router}
+  db_query('UNLOCK TABLES');
+
   // Sort the masks so they are in order of descending fit, and store them.
   $masks = array_keys($masks);
   rsort($masks);
