Well, this question appear to be simple, but my problem is a little bit more complex. I'll try to explain my situation.

I have a site with customized template and a bunch of modules (all 3rd party from Drupal contrib site). When **any content** needs to be updated, which means include, update or delete a node, page or panel causes a slow down in entire site. The site practically stops. For everyone (anonymous and logged users).

I began an investigation and I realized that **menu\_rebuild flag in semaphore table** is taking too long (~5 minutes) to disappear. This is causing trouble for every user who wants to navigate on the website, because menu\_rebuild is locking down the site.

One side effect of this menu\_rebuild lock is the queue of apache processes in the server. This leads the server to be overloaded (100% CPU).

My conclusion after this investigation is simple. Something (a module maybe) is firing the menu\_rebuild many times causing the site lockup. I tracked down the function in Drupal core that activate menu\_rebuild. See:

**includes/menu.inc**

```
/**
 * Populates the database tables used by various menu functions.
 *
 * This function will clear and populate the {menu_router} table, add entries
 * to {menu_links} for new router items, and then remove stale items from
 * {menu_links}. If called from update.php or install.php, it will also
 * schedule a call to itself on the first real page load from
 * menu_execute_active_handler(), because the maintenance page environment
 * is different and leaves stale data in the menu tables.
 *
 * @return
 *   TRUE if the menu was rebuilt, FALSE if another thread was rebuilding
 *   in parallel and the current thread just waited for completion.
 */
function menu_rebuild() {

  if (!lock_acquire('menu_rebuild')) {
    // Wait for another request that is already doing this work.
    // We choose to block here since otherwise the router item may not
    // be available in menu_execute_active_handler() resulting in a 404.
    lock_wait('menu_rebuild');
    return FALSE;
  }

  $transaction = db_transaction();

  try {
    list($menu, $masks) = menu_router_build();
    _menu_router_save($menu, $masks);
    _menu_navigation_links_rebuild($menu);
    // Clear the menu, page and block caches.
    menu_cache_clear_all();
    _menu_clear_page_cache();

    if (defined('MAINTENANCE_MODE')) {
      variable_set('menu_rebuild_needed', TRUE);
    }
    else {
      variable_del('menu_rebuild_needed');
    }
  }
  catch (Exception $e) {
    $transaction->rollback();
    watchdog_exception('menu', $e);
  }

  lock_release('menu_rebuild');

 return TRUE; 
}

```

When I comment the `lock_wait('menu_rebuild');` / `lock_release('menu_rebuild');` calls, my site runs smoothly and fast. But I can't do that. This affects the generation of new content.

I disabled all modules that I could without breaking the template. If you need to know what modules that I have installed, please ask.

I am using Drupal 7.23. My server configuration:

* Ubuntu 12.04 LTS
* 4 cores / 8GB RAM
* Apache 2.2.22;
* PHP 5.3.10 / FastCGI;

If you need information about apache configuration or PHP configuration, please let me know.

Update:

Here are all active modules in my site:

**[CORE]**

* Block
* Contact
* Content translation
* Contextual links
* Dashboard;
* Field;
* Field SQL Storage;
* Field UI;
* File
* Filter;
* Image;
* List;
* Locale;
* Menu;
* Node;
* Number;
* Options;
* Overlay;
* Path;
* RDF;
* Shortcut;
* System;
* Taxonomy;
* Text;
* Toolbar;
* Update Manager;
* User;

**[FIELDS]**

* Entity Reference;
* Link;
* Select(or other);

**[ACCESS CONTROL]**

* ACL;

**[SPAM CONTROL]**

* CAPTCHA;
* Image CAPTCHA;

**[DATE/HOUR]**

* Date;
* Date API;
* Date Popup;
* Date Views;

**[EMAIL]**

* Newsletter;
* SMTP Authentication Support

**[USER INTERFACE]**

* CKEditor;
* Options element;
* Pagestyle;

**[META TAGS (QUICK)]**

* Meta tags (quick);

**[LOCALIZATION]**

* Localization update;

**[INTERNATIONALIZATION]**

* Block languages;
* Contact translation;
* Field translation;
* Internationalization
* Menu translation;
* Multilingual contant;
* Multilingual select;
* Path translation;
* String translation;
* Synchronize translations
* Taxonomy translation;
* Translation redirect;
* Translation sets;
* Variable translation;

**[MEDIA]**

* File entity;
* IMCE;
* IMCE Mkdir;
* Media

**[OTHERS]**

* Entity API;
* Pathauto;
* Profile2;
* Profile2 pages;
* Token;
* Transliteration;
* Vocabulary Permissions Per Role;

**[PANELS]**

* Panels;

**[SUITE CHAOS TOOLS]**

* Chaos tools;
* Page manager;
* Views content panes;

**[VARIABLE]**

* Variable;
* Variable realm;
* Variable store;
* Variable views;

**[VIEWS]**

* Embed Views Display;
* Views;
* Views UI;

**[WEBFORM]**

* Webform;
* Webform validation;

**[WEBFORM DYNAMIC SELECT]**

* Webform options;

**[WORKBENCH]**

* Workbench;
* Workbench access;
* Workbench Media;
* Workbench Profile;

**[XML SITEMAP]**

* XML sitemap;
* XML sitemap engines;
* XML sitemap internationalization;
* XML sitemap menu;
* XML sitemap node;
* XML sitemap taxonomy;