trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject trafficserver git commit: Fix crash on partial fill.
Date Tue, 12 May 2015 04:13:52 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/ts-974-5-3-x e18407ca3 -> a7b775e20


Fix crash on partial fill.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a7b775e2
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a7b775e2
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a7b775e2

Branch: refs/heads/ts-974-5-3-x
Commit: a7b775e20a28f82b159715072cae16f6fdf4c579
Parents: e18407c
Author: Alan M. Carroll <solidwallofcode@yahoo-inc.com>
Authored: Mon May 11 23:13:31 2015 -0500
Committer: Alan M. Carroll <solidwallofcode@yahoo-inc.com>
Committed: Mon May 11 23:13:31 2015 -0500

----------------------------------------------------------------------
 iocore/cache/CacheHttp.cc | 16 ++++++++++------
 iocore/cache/CacheRead.cc |  3 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a7b775e2/iocore/cache/CacheHttp.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheHttp.cc b/iocore/cache/CacheHttp.cc
index 4b66ea6..623e5b8 100644
--- a/iocore/cache/CacheHttp.cc
+++ b/iocore/cache/CacheHttp.cc
@@ -284,8 +284,10 @@ CacheHTTPInfoVector::write_complete(CacheKey const& alt_key, CacheVC*
vc, bool s
   if (success) item._alternate.mark_frag_write(vc->fragment);
 
   // Kick all the waiters, success or fail.
-  while (NULL != (reader = item._waiting.pop()))
-    eventProcessor.schedule_imm(reader);
+  while (NULL != (reader = item._waiting.pop())) {
+    Debug("amc", "[write_complete] wake up %p", reader);
+    reader->wake_up_thread->schedule_imm(reader)->cookie = reinterpret_cast<void*>(0x56);
+  }
 
   return *this;
 }
@@ -323,10 +325,12 @@ CacheHTTPInfoVector::wait_for(CacheKey const& alt_key, CacheVC*
vc, int64_t offs
   Item& item = data[alt_idx];
   int frag_idx = item._alternate.get_frag_index_of(offset);
   vc->fragment = frag_idx; // really? Shouldn't this already be set?
-  if (item.has_writers())
-    item._waiting.push(vc);
-  else
+  if (item.has_writers()) {
+    if (! item._waiting.in(vc))
+      item._waiting.push(vc);
+  } else {
     zret = false;
+  }
   return zret;
 }
 
@@ -342,7 +346,7 @@ CacheHTTPInfoVector::close_writer(CacheKey const& alt_key, CacheVC*
vc)
   item._writers.remove(vc);
   while (NULL != (reader = item._waiting.pop())) {
     Debug("amc", "[close_writer] wake up %p", reader);
-    reader->wake_up_thread->schedule_imm(reader);
+    reader->wake_up_thread->schedule_imm(reader)->cookie = reinterpret_cast<void*>(0x56);
   }
   return *this;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a7b775e2/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index e1a8ee1..52a395c 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -318,12 +318,13 @@ CacheVC::openReadFromWriter(int event, Event *e)
     return openReadStartEarliest(event, e);
   } else {
     if (cache_config_select_alternate) {
-      alternate_index = HttpTransactCache::SelectFromAlternates(&vector, &request,
params);
+      alternate_index = HttpTransactCache::SelectFromAlternates(&od->vector, &request,
params);
       if (alternate_index < 0) {
         MUTEX_RELEASE(lock_od);
         SET_HANDLER(&CacheVC::openReadFromWriterFailure);
         return openReadFromWriterFailure(CACHE_EVENT_OPEN_READ_FAILED, reinterpret_cast<Event
*>(-ECACHE_ALT_MISS));
       }
+      write_vector = &od->vector;
     } else {
       alternate_index = 0;
     }


Mime
View raw message