You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2014/07/09 20:37:13 UTC

[1/3] git commit: Revert "TS-2780: Core dump in SpdyRequest::clear() in production testing of SPDY"

Repository: trafficserver
Updated Branches:
  refs/heads/master 20e38ded8 -> 993bf5b23


Revert "TS-2780: Core dump in SpdyRequest::clear() in production testing of SPDY"

This reverts commit c9d4433531767c9b5f6db42b488af4552bc5c4a9.


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

Branch: refs/heads/master
Commit: 59d0e65224860cd906f04ed18aed4951baba05ba
Parents: 20e38de
Author: Bryan Call <bc...@apache.org>
Authored: Wed Jul 9 11:08:45 2014 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Wed Jul 9 11:08:45 2014 -0700

----------------------------------------------------------------------
 proxy/spdy/SpdyCallbacks.cc     | 10 ++++------
 proxy/spdy/SpdyClientSession.cc |  3 +--
 2 files changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/59d0e652/proxy/spdy/SpdyCallbacks.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCallbacks.cc b/proxy/spdy/SpdyCallbacks.cc
index 2023e0c..ef66654 100644
--- a/proxy/spdy/SpdyCallbacks.cc
+++ b/proxy/spdy/SpdyCallbacks.cc
@@ -350,13 +350,12 @@ spdy_on_data_chunk_recv_callback(spdylay_session * /*session*/, uint8_t /*flags*
                                  size_t len, void *user_data)
 {
   SpdyClientSession *sm = (SpdyClientSession *)user_data;
-  SpdyRequest *req = NULL;
-  map<int32_t, SpdyRequest*>::iterator iter = sm->req_map.find(stream_id);
+  SpdyRequest *req = sm->req_map[stream_id];
 
   //
   // SpdyRequest has been deleted on error, drop this data;
   //
-  if ((iter == sm->req_map.end()) || ((req=iter->second) == NULL))
+  if (!req)
     return;
 
   Debug("spdy", "++++Fetcher Append Data, len:%zu", len);
@@ -370,8 +369,7 @@ spdy_on_data_recv_callback(spdylay_session *session, uint8_t flags,
                            int32_t stream_id, int32_t length, void *user_data)
 {
   SpdyClientSession *sm = (SpdyClientSession *)user_data;
-  SpdyRequest *req = NULL;
-  map<int32_t, SpdyRequest*>::iterator iter = sm->req_map.find(stream_id);
+  SpdyRequest *req = sm->req_map[stream_id];
 
   spdy_show_data_frame("++++RECV", session, flags, stream_id, length, user_data);
 
@@ -380,7 +378,7 @@ spdy_on_data_recv_callback(spdylay_session *session, uint8_t flags,
   // client might continue to send POST data, We should reenable
   // sm->write_vio so that WINDOW_UPDATE has a chance to be sent.
   //
-  if ((iter == sm->req_map.end()) || ((req=iter->second) == NULL)) {
+  if (!req) {
     TSVIOReenable(sm->write_vio);
     return;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/59d0e652/proxy/spdy/SpdyClientSession.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyClientSession.cc b/proxy/spdy/SpdyClientSession.cc
index f816ba9..6367e67 100644
--- a/proxy/spdy/SpdyClientSession.cc
+++ b/proxy/spdy/SpdyClientSession.cc
@@ -378,12 +378,11 @@ spdy_read_fetch_body_callback(spdylay_session * /*session*/, int32_t stream_id,
 
   SpdyClientSession *sm = (SpdyClientSession *)user_data;
   SpdyRequest *req = (SpdyRequest *)source->ptr;
-  map<int32_t, SpdyRequest*>::iterator iter = sm->req_map.find(stream_id);
 
   //
   // req has been deleted, ignore this data.
   //
-  if ((iter == sm->req_map.end()) || (req != iter->second)) {
+  if (req != sm->req_map[stream_id]) {
     Debug("spdy", "    stream_id:%d, call:%d, req has been deleted, return 0",
           stream_id, g_call_cnt);
     *eof = 1;


[3/3] git commit: updated changes to include TS-2780

Posted by bc...@apache.org.
updated changes to include TS-2780


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

Branch: refs/heads/master
Commit: 993bf5b23757abe95a657e0eee22c914a0964dbf
Parents: fbf966e
Author: Bryan Call <bc...@apache.org>
Authored: Wed Jul 9 11:36:47 2014 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Wed Jul 9 11:36:47 2014 -0700

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/993bf5b2/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index c51d3b2..81f549d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.1.0
 
+  *) [TS-2780] Core dump in SpdyRequest::clear() in production testing of SPDY
+
   *) [TS-2929] SPDY should allow arbitrary methods
 
   *) [TS-2921] Fix build failure from TS-2893.


[2/3] git commit: TS-2780: Core dump in SpdyRequest::clear() in production testing of SPDY

Posted by bc...@apache.org.
TS-2780: Core dump in SpdyRequest::clear() in production testing of SPDY


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

Branch: refs/heads/master
Commit: fbf966eb603e2a202fe91144bd1a098fec628a6e
Parents: 59d0e65
Author: Sudheer Vinukonda <su...@yahoo-inc.com>
Authored: Wed Jul 9 11:35:20 2014 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Wed Jul 9 11:35:20 2014 -0700

----------------------------------------------------------------------
 proxy/spdy/SpdyCallbacks.cc     |  9 +++++----
 proxy/spdy/SpdyCallbacks.h      |  2 +-
 proxy/spdy/SpdyClientSession.cc | 19 ++++++++++---------
 proxy/spdy/SpdyClientSession.h  | 20 ++++++++++++++++++--
 4 files changed, 34 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbf966eb/proxy/spdy/SpdyCallbacks.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCallbacks.cc b/proxy/spdy/SpdyCallbacks.cc
index ef66654..a1a585f 100644
--- a/proxy/spdy/SpdyCallbacks.cc
+++ b/proxy/spdy/SpdyCallbacks.cc
@@ -50,7 +50,7 @@ spdy_callbacks_init(spdylay_session_callbacks *callbacks)
 }
 
 void
-spdy_prepare_status_response(SpdyClientSession *sm, int stream_id, const char *status)
+spdy_prepare_status_response_and_clean_request(SpdyClientSession *sm, int stream_id, const char *status)
 {
   SpdyRequest *req = sm->req_map[stream_id];
   string date_str = http_date(time(0));
@@ -76,6 +76,7 @@ spdy_prepare_status_response(SpdyClientSession *sm, int stream_id, const char *s
 
   TSVIOReenable(sm->write_vio);
   delete [] nv;
+  sm->cleanup_request(stream_id);
 }
 
 static void
@@ -289,7 +290,7 @@ spdy_process_syn_stream_frame(SpdyClientSession *sm, SpdyRequest *req)
 
   if(!req->path.size()|| !req->method.size() || !req->scheme.size()
      || !req->version.size() || !req->host.size()) {
-    spdy_prepare_status_response(sm, req->stream_id, STATUS_400);
+    spdy_prepare_status_response_and_clean_request(sm, req->stream_id, STATUS_400);
     return;
   }
 
@@ -350,7 +351,7 @@ spdy_on_data_chunk_recv_callback(spdylay_session * /*session*/, uint8_t /*flags*
                                  size_t len, void *user_data)
 {
   SpdyClientSession *sm = (SpdyClientSession *)user_data;
-  SpdyRequest *req = sm->req_map[stream_id];
+  SpdyRequest *req = sm->find_request(stream_id);
 
   //
   // SpdyRequest has been deleted on error, drop this data;
@@ -369,7 +370,7 @@ spdy_on_data_recv_callback(spdylay_session *session, uint8_t flags,
                            int32_t stream_id, int32_t length, void *user_data)
 {
   SpdyClientSession *sm = (SpdyClientSession *)user_data;
-  SpdyRequest *req = sm->req_map[stream_id];
+  SpdyRequest *req = sm->find_request(stream_id);
 
   spdy_show_data_frame("++++RECV", session, flags, stream_id, length, user_data);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbf966eb/proxy/spdy/SpdyCallbacks.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyCallbacks.h b/proxy/spdy/SpdyCallbacks.h
index ebe3c71..4d6c54e 100644
--- a/proxy/spdy/SpdyCallbacks.h
+++ b/proxy/spdy/SpdyCallbacks.h
@@ -28,7 +28,7 @@
 class SpdyClientSession;
 
 void spdy_callbacks_init(spdylay_session_callbacks *callbacks);
-void spdy_prepare_status_response(SpdyClientSession *sm, int stream_id, const char *status);
+void spdy_prepare_status_response_and_clean_request(SpdyClientSession *sm, int stream_id, const char *status);
 
 /**
  * @functypedef

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbf966eb/proxy/spdy/SpdyClientSession.cc
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyClientSession.cc b/proxy/spdy/SpdyClientSession.cc
index 6367e67..0c50940 100644
--- a/proxy/spdy/SpdyClientSession.cc
+++ b/proxy/spdy/SpdyClientSession.cc
@@ -336,16 +336,19 @@ spdy_process_fetch(TSEvent event, SpdyClientSession *sm, void *edata)
     Debug("spdy", "----[FETCH ERROR]");
     if (req->fetch_body_completed)
       ret = 0; // Ignore fetch errors after FETCH BODY DONE
-    else
+    else {
+      Error("spdy_process_fetch fetch error, fetch_sm %p, ret %d for sm_id %" PRId64 ", stream_id %u, req time %" PRId64 ", url %s", req->fetch_sm, ret, sm->sm_id, req->stream_id, req->start_time, req->url.c_str());
       req->fetch_sm = NULL;
+    }
     break;
   }
 
   if (ret) {
-    spdy_prepare_status_response(sm, req->stream_id, STATUS_500);
-    sm->req_map.erase(req->stream_id);
-    req->clear();
-    spdyRequestAllocator.free(req);
+    Error("spdy_process_fetch sending STATUS_500, fetch_sm %p, ret %d for sm_id %" PRId64 ", stream_id %u, req time %" PRId64 ", url %s", req->fetch_sm, ret, sm->sm_id, req->stream_id, req->start_time, req->url.c_str());
+    spdy_prepare_status_response_and_clean_request(sm, req->stream_id, STATUS_500);
+    // It is better to send back a 500 response on the stream and have the client connection remain open.  However, we
+    // have seen a core around this.  We have a local patch to close the client connection (return -1) this is related
+    // to TS-2883.  TS-2883 still needs to be fixed.
   }
 
   return 0;
@@ -382,7 +385,7 @@ spdy_read_fetch_body_callback(spdylay_session * /*session*/, int32_t stream_id,
   //
   // req has been deleted, ignore this data.
   //
-  if (req != sm->req_map[stream_id]) {
+  if (req != sm->find_request(stream_id)) {
     Debug("spdy", "    stream_id:%d, call:%d, req has been deleted, return 0",
           stream_id, g_call_cnt);
     *eof = 1;
@@ -416,9 +419,7 @@ spdy_read_fetch_body_callback(spdylay_session * /*session*/, int32_t stream_id,
         }
       }
       *eof = 1;
-      sm->req_map.erase(stream_id);
-      req->clear();
-      spdyRequestAllocator.free(req);
+      sm->cleanup_request(stream_id);
     } else if (already == 0) {
       req->need_resume_data = true;
       return SPDYLAY_ERR_DEFERRED;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbf966eb/proxy/spdy/SpdyClientSession.h
----------------------------------------------------------------------
diff --git a/proxy/spdy/SpdyClientSession.h b/proxy/spdy/SpdyClientSession.h
index f0112c1..e61c0ed 100644
--- a/proxy/spdy/SpdyClientSession.h
+++ b/proxy/spdy/SpdyClientSession.h
@@ -91,6 +91,8 @@ public:
   MD5_CTX recv_md5;
 };
 
+extern ClassAllocator<SpdyRequest> spdyRequestAllocator;
+
 class SpdyClientSession : public Continuation, public PluginIdentity
 {
 
@@ -130,6 +132,22 @@ public:
   virtual char const* getPluginTag() const;
   virtual int64_t getPluginId() const;
 
+  SpdyRequest *
+  find_request(int streamId) {
+    map<int32_t, SpdyRequest*>::iterator iter = this->req_map.find(streamId);
+    return ((iter == this->req_map.end()) ? NULL : iter->second);
+  }
+
+  void
+  cleanup_request(int streamId) {
+    SpdyRequest* req = this->find_request(streamId);
+    if (req) {
+      req->clear();
+      spdyRequestAllocator.free(req);
+      this->req_map.erase(streamId);
+    }
+  }
+
 private:
   int state_session_start(int event, void * edata);
   int state_session_readwrite(int event, void * edata);
@@ -137,6 +155,4 @@ private:
 
 void spdy_cs_create(NetVConnection * netvc, spdy::SessionVersion vers, MIOBuffer * iobuf, IOBufferReader * reader);
 
-extern ClassAllocator<SpdyRequest> spdyRequestAllocator;
-
 #endif