[support] Error Retrieving Form From Cache

Steve Edwards killshot91 at gmail.com
Tue Aug 23 18:23:22 UTC 2011


I have been struggling for a few days with an issue with core form caching that is seen in filefield_sources (D6).  When I attempt to add an image using the Reference Existing option, I get the error "An unrecoverable error occurred. This form was missing from the server cache. Try reloading the page and submitting again." Other people have had the same error (see http://drupal.org/node/500646 and http://drupal.org/node/795004 for examples.).

The main thing I'm not understanding is why the data is not being returned from the cache table.  First, here is the code from filefield module (the filefield_js() function) that throws the error:

  // Build the new form.
  $form_state = array('submitted' => FALSE);
  $form_build_id = $_POST['form_build_id'];
  $form = form_get_cache($form_build_id, $form_state);

  if (!$form) {
    // Invalid form_build_id.
    drupal_set_message(t('An unrecoverable error occurred. This form was missing from the server cache. Try reloading the page and submitting again.'), 'error');
    print drupal_to_js(array('data' => theme('status_messages')));
    exit;
  }

As quicksketch points out in one of the issues, when the form is initially displayed, it should be cached in cache_form, and this error indicates that the form was not cached, and therefore is not retrieved from cache_form (he also points out this is not a filefield issue, but rather a core caching issue).  However, in watching the db, I can see that the form is saved in the cache (and I verified it using the form id displayed in the HTML against the cid value in cache_form), so it is there for to be retrieved by form_get_cache().  The only other option I can see is that $_POST['form_build_id'] is not available for some reason.

What makes this more difficult is that I can't duplicate this on my local machine or our dev server.  This only happens on the production server at the hosting company.  Varnish is being used, but since this functionality is only used for logged in users, that should be an issue as far as I can tell.

Can anyone offer any suggestions on how to fix this?

Thanks.

Steve


More information about the support mailing list