We included "memcache.inc" and are using ImageField 6.x-3.0 (and FileField 6.x-3.0) to upload an image on a node add/edit page.
Browsing for the image and uploading it works as expected, but always when we try do perform more than one AHAH action on the same field (e.g. remove the image after uploading it) we get the error "An unrecoverable error occurred. This form was missing from the server cache. Try reloading the page and submitting again."
It turned out that the form_get_cache() call in filefield_js() function of filefield.module returns a $form object only for the first AHAH action, because thereafter the $form object has disappered from the 'cache_form' bin. When working with normal database caching the form remains in the 'cache_form' database table. Surprisingly, however, it also works as expected if "memcache.db.inc" is used, and indeed I found that there is a different behaviour between that and the "memcache.inc" implementation.
In "memcache.db.inc" dmemcache_flush() is called for the conditions
if (!empty($cid) && $wildcard && $cid == '*') ...
while in "memcache.inc" the conditions are
if (!empty($cid) && !($cid == '*' && $wildcard !== TRUE) && ($cid == '*' || $wildcard === TRUE)) ...
I think the "||" in the third clause must be an "&&".
We are currently using Memcache 6.x-1.2, but I've seen the same issue with the current 6.x-1.x-dev version.
Comments
Comment #1
dicreat CreditAttribution: dicreat commentedI have the same error with memcache 6.x-1.x-dev and filefield 6.x-3.1 modules.
Comment #2
Jeremy CreditAttribution: Jeremy commentedThere is no way to do a partial flush with memcache, as you can't search/match a set of keys. Memcache can only perform hash lookups. As such, we treat a partial flush of multiple wildcard items from a bin the same as a total flush of the entire bin. The behavior in memcache.db.inc is to just ignore a partial flush, which I'm not sure is a particularly good idea.
In your specific example, I'm going to guess that someone is doing a partial flush of the 'cache_form' bin? Perhaps provide more of the code?
Comment #3
DamienMcKennamindgame and dicreat: have you tried talking with quicksketch on IRC about this, or adding an issue to the FileField/ImageField queue?
Comment #4
asb CreditAttribution: asb commentedA similar issue hit me immediately after enabling memcache.module. This steps might help to reproduce the error:
* upload an image into an imagefield
* clone the node containing the imagefield with node_clone.module
* try removing/replacing the file from the imagefield, voila!
Steps to pro the involvement of memcache.module:
* disable/mutilate your memcache, e.g. by setting localhost:11211 to localhost:11212 in settings.php, if you're only running one memcache at localhost:11212
Replacing images in Imagefield will immediately start to work again.
Related issues:
* #539476: "Unrecoverable error" is giving *me* a headache, too!
* #500220: Wrong conditions for cache flush in memcache.inc?
* #486880: I can't upload second image
Any ideas or suggestions?
Thanks & greetings,
-asb
Comment #5
ckngI'm facing the same problem, using memcache.db.inc solves the problem.
The problem lies in the memcache.inc.
Comment #6
rapsli CreditAttribution: rapsli commentedconfirm. memcache.db.inc works.
Whats the different between those two files?
Comment #7
Scott Reynolds CreditAttribution: Scott Reynolds commentedmake sure that you have cache_form in its own bin. That is how we fix this on our side.
Once it was separated all AHAH stuff worked well.
Comment #8
aries CreditAttribution: aries commented+1, i separated the forms into a different bin and the problem is solved.
Comment #9
mrfelton CreditAttribution: mrfelton commentedbut you need two servers if you are to separate out the bins. We only have one, and I can;t find a way to start more than one memcached on just one server.
Comment #10
DamienMcKennaYou need to start multiple copies of memcached with each on a different port. For one site I wrote a tiny script that ran the following:
(and eight more buckets..)
Comment #11
andypostIs there plans to implement "wildcard flush"?
Comment #12
mrfelton CreditAttribution: mrfelton commentedyeas, but this is difficult to get running from an init script - out of the box. Anyway, we shouldn't need to have to do this, surely.
Comment #13
scroogie CreditAttribution: scroogie commentedI hit the same problem today. It should really be advertised on the modules page! A lot of modules do partial flushes, among those I had installed alone it was CCK, content_profile, date, filefield, imagecache, img_assist and logintoboggan.
I've also read up on the issue on the memcache side, and indeed there is no way to do a partial flush without using some tricks (see http://code.google.com/p/memcached/wiki/FAQ#Namespaces). This trick will slow down all caches if it's used generally, though, so this could only be solved by replacing wildcards in the drupal cache API with namespaces. Perhaps this should be considered in D7? Or is it too late already?
Comment #14
moshe weitzman CreditAttribution: moshe weitzman commentedeconomist.com now bitten by this. lets consolidate conversation in #224772: problem with cache_clear_all
Comment #15
borgo CreditAttribution: borgo commentedProblem with filefield AHAH seems to disappear after switching memcache to DB mode
And disabling 'Show memcache statistics at the bottom of each page; at admin/settings/memcache. The moment I turn statistics display ON again, I get nasty loong JS alerts back after hitting 'Upload'.
Comment #16
fuzzy76 CreditAttribution: fuzzy76 commentedSorry for reopening, but I don't think #224772: problem with cache_clear_all is related to this issue at all. That issue is about how a wildcard flush is triggered, while this issue is about what a wildcard flush is supposed to do. We get these alerts from time to time, though not consistently. I guess #801348: Some caches are not caches really. might be more related.