I add a webform node to another node via hook_page_alter() or in a block. Sometimes when submitting this form it doesn't submit the data and redirect to the Custom URL set in the settings. Right after I see the the form give me this issue I notice that the submitted data does not appear under Results -> Submissions. It only happens right after clearing the cache. Once it happens if you refresh the page or go to another page that has the form it doesn't happen. If I go to the actual node that is the webform I can't reproduce this issue.
Below are the steps I take to reproduce this problem (FYI I can only reproduce it sometimes. I can reproduce it logged in as user 1 but I have better luck reproducing as anonymous user):
Flush all cache via drush cc all command
Refresh page with form
Fill out form and submit
Notice that the page refreshes instead of going to destination url (this happens maybe 40% of the time)
This is how I display the webform on certain nodes via hook_page_alter():
$get_my_free_download_node = node_load($nid); $markup = drupal_render(node_view($get_my_free_download_node, 'hcp_gmfd_slide_in')); $page['content']['sliding_panel'] = array( '#markup' => $script . $markup, );
I am using Webform 7.x-3.24. I added debug code webform_client_form_submit() and my code never gets run when this issue happens.
I'm wondering if Varnish or Memcache is causing this issue? I don't ever remember seeing this a long time ago but I don't think I ever did a test of clearing the cache and testing the form right away.
These are my Memcache settings in settings.php:
$conf['cache_backends'] = 'sites/all/modules/memcache/memcache.inc'; $conf['cache_default_class'] = 'MemCacheDrupal'; $conf['cache_inc'] = './sites/all/modules/memcache/memcache.inc'; $conf['cache_class_cache_form'] = 'DrupalDatabaseCache'; $conf['memcache_servers'] = array('127.0.0.1:11211' => 'default'); $conf['memcache_bins'] = array('cache' => 'default'); $conf['memcache_key_prefix'] = 'AW'; $conf['reverse_proxy'] = true; $conf['reverse_proxy_addresses'] = array('127.0.0.1'); # Bypass Drupal bootstrap for anonymous users so that Drupal sets max-age > 0 $conf['page_cache_invoke_hooks'] = FALSE; # Fix for admin_menu disappearing see https://drupal.org/node/442560#comment-2692220 $conf['admin_menu_cache_client'] = FALSE;
I originally stated that this only happened in production but after testing locally more often I was able to replicate the issue locally.