3

I have a site where saving or deleting content frequently displays an error message "The form has become outdated. Copy any unsaved work and then reload this page"

  • It does not seem to matter what type of content.
  • It happens on new content, as well as editing existing content.
  • It doesn't matter how long the page is open before Save/Delete is clicked.
  • There is only one person editing at a time.

Can someone suggest a way to track down this bug as it's proving difficult to find.

  • 1
    I have only seen this happen when I have had 2 browsers open on the same form then tried to save one. – 2pha Feb 8 '13 at 9:07
  • This happens because a new session is created sometime when the form is being edited; so the edit becomes invalid as it is from previous session. Are you using authentication other than the default authentication provided by Drupal? – AjitS Feb 8 '13 at 9:29
  • Can you paste your list of module? – monymirza Feb 8 '13 at 9:33
  • Modules are: acl advanced_forum apply_for_role backup_migrate backup_migrate_files better_exposed_filters drupal calendar captcha carousel cf chain_menu_access ckeditor_link config_perms content_access context context_menu_block ctools date enabled_modules entity features feeds field_collection field_permissions field_slideshow file_entity flood_control forum_access imce imce_wysiwyg – Rob Feb 8 '13 at 9:54
  • job_scheduler libraries link logintoboggan login_destination mail_edit media media_update menu_block references panels panels_breadcrumbs pathauto pathauto_persist pathologic rename_admin_paths rules scheduler security_review site_map stringoverrides subscriptions superfish – Rob Feb 8 '13 at 9:54
1

Take a look at the answer provided by warwickshaw on D.O https://www.drupal.org/node/2241311#comment-8791165

To fix the error message: 'The form has become outdated. ...' try moving the 'drupal_private_key' in to the Drupal 7 settings.php file.

The Issue See https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_ge... drupal_get_private_key() is not a safe function.

When variable_get() doesn't return a $key (some outage, maybe a memcached restarted) you suddenly and silently get assigned a new drupal_get_private_key.

If you are using multiple server Drupal system where each server has it's own MySql database replicated from a Master DB, a Slave DB can end up with it's own key (which Master doesn't see) and when the slave gets it's key cached in memcached the fun begins.

Mean while back in the D7 Admin, forms and menus that once worked start failing!

The Fix The only safe place in D7 whether using a single or multi-server setup is to move 'drupal_private_key' value to the settings.php file.

Add $conf['drupal_private_key'] = '...';

To get the value execute on the Staging server (MySql master) drush ev 'print drupal_get_private_key();' and assign the value above.

You should have something like this (these are example values, don't use) $drupal_hash_salt = 'j8lnCx-XF3gq_2NmnnHZ61Q3xlbKHFSzZ9EmUouPwKU'; $conf['drupal_private_key'] = 'Fnll-1ZETTb03CgO6PW4COWT7CjTBeRSAQzXqerq6FA';

Check the hash_salt is behaving correctly (should match $drupal_hash_salt) drush ev 'print drupal_get_hash_salt();'

Copy these setting to all other servers in the same Drupal cluster.

On Stage update 'drupal_private_key' row with value used in the settings.php file. This will replicate and reset any MySql slaves out of sync. update variable set value = '[drupal_private_key]' where name = 'drupal_private_key';

On Stage execute drush cc all

Clear your browser cache.

You are good to go!

New D7 Projects When ever you create a new Drupal project make this the first task after installation.

Other Symptoms of the Same Bug Multiple Save, Cancel buttons appears after clicking Save or Cancel in Page layouts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.