trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick McManus <mcma...@ducksong.com>
Subject Re: ts 2.0.0 failed assert `FATAL: CacheDir.cc:693
Date Wed, 11 Aug 2010 23:04:56 GMT
On Wed, 2010-08-11 at 17:51 -0400, Patrick McManus wrote:
> On Wed, 2010-08-11 at 13:27 -0700, John Plevyak wrote:
> > I have created a bug:
> > 
> > https://issues.apache.org/jira/secure/ManageAttachments.jspa?id=12471346
> > 
> > 
> > There is a patch attached.  See if that fixes your problem.
> > 
> > john
> 
> John,
> 
> A million thank yous for looking at the issue. Definite progress, but it
> now assert()s in a different place. Seemingly on the cache read path -
> 
> 
> FATAL: CacheRead.cc:981: failed assert `f.single_segment`

On closer inspection there is a valid path for !f.single_segment - we
just need to update the patch to take that now that we have violated the
assumption.

Does this updated patch make sense to you? It passes my tests with
flying colors..

diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 09195d8..3a0bad7 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -978,10 +978,12 @@ CacheVC::openReadStartHead(int event, Event * e)
     doc_len = alternate.object_size_get();
     if (key == doc->key) {      // is this my data?
       f.single_segment = doc->single_segment();
-      ink_assert(f.single_segment);     // otherwise need to read earliest
-      ink_assert(doc->hlen);
-      docpos = sizeofDoc + doc->hlen;
-      next_CacheKey(&key, &doc->key);
+      if (f.single_segment)
+       {
+         ink_assert(doc->hlen);
+         docpos = sizeofDoc + doc->hlen;
+         next_CacheKey(&key, &doc->key);
+       }
     } else {
       f.single_segment = false;
     }
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index a1f529a..8e59db1 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -191,10 +191,14 @@ CacheVC::handleWrite(int event, Event * e)
     vec_len = 0;
   set_agg_write_in_progress();
   POP_HANDLER;
-  agg_len = round_to_approx_size(write_len + vec_len + sizeofDoc);
+  int to_write = write_len + vec_len + sizeofDoc;
+  if (to_write > MAX_FRAG_SIZE) {
+    write_len = MAX_FRAG_SIZE - vec_len - sizeofDoc;
+    to_write = MAX_FRAG_SIZE;
+  }
+  agg_len = round_to_approx_size(to_write);
   part->agg_todo_size += agg_len;
-  ink_assert(agg_len <= AGG_SIZE);
-  bool agg_error = (agg_len > AGG_SIZE ||
+  bool agg_error = (agg_len > AGG_SIZE || write_len < 0 ||
                     (!f.readers && (part->agg_todo_size > cache_config_agg_write_backlog
+ AGG_SIZE) && write_len));
 #ifdef CACHE_AGG_FAIL_RATE
   agg_error = agg_error || ((inku32) mutex->thread_holding->generator.random() <
@@ -211,6 +215,7 @@ CacheVC::handleWrite(int event, Event * e)
     io.aio_result = AIO_SOFT_FAILURE;
     return handleEvent(AIO_EVENT_DONE, 0);
   }
+  ink_assert(agg_len <= AGG_SIZE);
   if (f.evac_vector)
     part->agg.push(this);
   else




Mime
View raw message