On 18 Nov 2011, at 9:50 PM, f_los_ch wrote:

When enabling mod_cache in my reverse-proxy scenario, the first file
with a filesize above some threshold gets delivered corrupted,
subsequent requests served from cache are fine.

Can you confirm if the following patch makes any difference for you? I suspect the disk cache is finding a way to leave without passing all the saved buckets to out first.

Index: modules/cache/mod_cache_disk.c
===================================================================
--- modules/cache/mod_cache_disk.c      (revision 1203646)
+++ modules/cache/mod_cache_disk.c      (working copy)
@@ -1098,7 +1098,7 @@
/* are we done completely? if so, pass any trailing buckets right through */
         if (dobj->done || !dobj->data.pool) {
             APR_BUCKET_REMOVE(e);
-            APR_BRIGADE_INSERT_TAIL(out, e);
+            APR_BRIGADE_INSERT_TAIL(dobj->bb, e);
             continue;
         }

@@ -1107,16 +1107,14 @@
             seen_eos = 1;
             dobj->done = 1;
             APR_BUCKET_REMOVE(e);
-            APR_BRIGADE_CONCAT(out, dobj->bb);
-            APR_BRIGADE_INSERT_TAIL(out, e);
+            APR_BRIGADE_INSERT_TAIL(dobj->bb, e);
             break;
         }

         /* honour flush buckets, we'll get called again */
         if (APR_BUCKET_IS_FLUSH(e)) {
             APR_BUCKET_REMOVE(e);
-            APR_BRIGADE_CONCAT(out, dobj->bb);
-            APR_BRIGADE_INSERT_TAIL(out, e);
+            APR_BRIGADE_INSERT_TAIL(dobj->bb, e);
             break;
         }

@@ -1203,17 +1201,18 @@
         dobj->offset -= length;
         if (dobj->offset <= 0) {
             dobj->offset = 0;
-            APR_BRIGADE_CONCAT(out, dobj->bb);
             break;
         }
         if ((dconf->readtime && apr_time_now() > dobj->timeout)) {
             dobj->timeout = 0;
-            APR_BRIGADE_CONCAT(out, dobj->bb);
             break;
         }

     }

+    /* make sure we sweep all saved buckets to the out brigade */
+    APR_BRIGADE_CONCAT(out, dobj->bb);
+
/* Was this the final bucket? If yes, close the temp file and perform
      * sanity checks.
      */

Regards,
Graham
--

Reply via email to