You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by su...@apache.org on 2016/02/01 19:03:28 UTC
[1/4] trafficserver git commit: [TS-4135] fix redirect coredump
Repository: trafficserver
Updated Branches:
refs/heads/master f8ce9e97f -> 74d8bb483
[TS-4135] fix redirect coredump
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/17cc1561
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/17cc1561
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/17cc1561
Branch: refs/heads/master
Commit: 17cc1561b25bb4f1be9834d9f7e94dcdeef868bf
Parents: f8ce9e9
Author: Sandeep Davu <sd...@sniffcliff.corp.ne1.yahoo.com>
Authored: Fri Jan 29 00:13:00 2016 +0000
Committer: Sudheer Vinukonda <su...@yahoo-inc.com>
Committed: Mon Feb 1 18:03:15 2016 +0000
----------------------------------------------------------------------
lib/atscppapi/src/Request.cc | 5 -----
lib/atscppapi/src/Transaction.cc | 34 +++++-----------------------------
2 files changed, 5 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17cc1561/lib/atscppapi/src/Request.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Request.cc b/lib/atscppapi/src/Request.cc
index 6e1166e..250f4f5 100644
--- a/lib/atscppapi/src/Request.cc
+++ b/lib/atscppapi/src/Request.cc
@@ -84,11 +84,6 @@ Request::Request(const string &url_str, HttpMethod method, HttpVersion version)
void
Request::init(void *hdr_buf, void *hdr_loc)
{
- if (state_->hdr_buf_ || state_->hdr_loc_) {
- LOG_ERROR("Reinitialization; (hdr_buf, hdr_loc) current(%p, %p), attempted(%p, %p)", state_->hdr_buf_, state_->hdr_loc_,
- hdr_buf, hdr_loc);
- return;
- }
state_->hdr_buf_ = static_cast<TSMBuffer>(hdr_buf);
state_->hdr_loc_ = static_cast<TSMLoc>(hdr_loc);
state_->headers_.reset(state_->hdr_buf_, state_->hdr_loc_);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/17cc1561/lib/atscppapi/src/Transaction.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc
index b9396ef..8790c00 100644
--- a/lib/atscppapi/src/Transaction.cc
+++ b/lib/atscppapi/src/Transaction.cc
@@ -86,28 +86,6 @@ Transaction::Transaction(void *raw_txn)
Transaction::~Transaction()
{
LOG_DEBUG("Transaction tshttptxn=%p destroying Transaction object %p", state_->txn_, this);
- static const TSMLoc NULL_PARENT_LOC = NULL;
- TSHandleMLocRelease(state_->client_request_hdr_buf_, NULL_PARENT_LOC, state_->client_request_hdr_loc_);
- if (state_->server_request_hdr_buf_ && state_->server_request_hdr_loc_) {
- LOG_DEBUG("Releasing server request");
- TSHandleMLocRelease(state_->server_request_hdr_buf_, NULL_PARENT_LOC, state_->server_request_hdr_loc_);
- }
- if (state_->server_response_hdr_buf_ && state_->server_response_hdr_loc_) {
- LOG_DEBUG("Releasing server response");
- TSHandleMLocRelease(state_->server_response_hdr_buf_, NULL_PARENT_LOC, state_->server_response_hdr_loc_);
- }
- if (state_->client_response_hdr_buf_ && state_->client_response_hdr_loc_) {
- LOG_DEBUG("Releasing client response");
- TSHandleMLocRelease(state_->client_response_hdr_buf_, NULL_PARENT_LOC, state_->client_response_hdr_loc_);
- }
- if (state_->cached_request_hdr_buf_ && state_->cached_request_hdr_loc_) {
- LOG_DEBUG("Releasing cached request");
- TSHandleMLocRelease(state_->cached_request_hdr_buf_, NULL_PARENT_LOC, state_->cached_request_hdr_loc_);
- }
- if (state_->cached_response_hdr_buf_ && state_->cached_response_hdr_loc_) {
- LOG_DEBUG("Releasing cached response");
- TSHandleMLocRelease(state_->cached_response_hdr_buf_, NULL_PARENT_LOC, state_->cached_response_hdr_loc_);
- }
delete state_;
}
@@ -433,14 +411,12 @@ public:
initializeHandles(GetterFunction getter) : getter_(getter) {}
bool operator()(TSHttpTxn txn, TSMBuffer &hdr_buf, TSMLoc &hdr_loc, const char *handles_name)
{
- if (!hdr_buf && !hdr_loc) {
- if (getter_(txn, &hdr_buf, &hdr_loc) == TS_SUCCESS) {
- return true;
- } else {
- LOG_ERROR("Could not get %s", handles_name);
- }
+ hdr_buf = NULL;
+ hdr_loc = NULL;
+ if (getter_(txn, &hdr_buf, &hdr_loc) == TS_SUCCESS) {
+ return true;
} else {
- LOG_ERROR("%s already initialized", handles_name);
+ LOG_ERROR("Could not get %s", handles_name);
}
return false;
}
[2/4] trafficserver git commit: [TS-4160] Reset the txn
request/response handles at each hook, since core may destroy them.
Posted by su...@apache.org.
[TS-4160] Reset the txn request/response handles at each hook, since core may destroy them.
[TS-4160] clean up the code and initialize all handles for all hooks.
[TS-4160] move the reset of handles to NULL to the operator() from TS-4135.
[TS-4160] remove unnecessary reset.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ef31c385
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ef31c385
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ef31c385
Branch: refs/heads/master
Commit: ef31c3852f7e03b155de99d973057394790f1782
Parents: 17cc156
Author: Sudheer Vinukonda <su...@yahoo-inc.com>
Authored: Fri Jan 29 01:00:10 2016 +0000
Committer: Sudheer Vinukonda <su...@yahoo-inc.com>
Committed: Mon Feb 1 18:03:16 2016 +0000
----------------------------------------------------------------------
lib/atscppapi/src/utils_internal.cc | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ef31c385/lib/atscppapi/src/utils_internal.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/utils_internal.cc b/lib/atscppapi/src/utils_internal.cc
index ff0012e..dd7bca4 100644
--- a/lib/atscppapi/src/utils_internal.cc
+++ b/lib/atscppapi/src/utils_internal.cc
@@ -43,6 +43,18 @@ namespace
const int MAX_TXN_ARG = 15;
const int TRANSACTION_STORAGE_INDEX = MAX_TXN_ARG;
+void
+initTransactionHandles(Transaction &transaction)
+{
+ utils::internal::initTransactionCachedRequest(transaction);
+ utils::internal::initTransactionCachedResponse(transaction);
+ utils::internal::initTransactionServerRequest(transaction);
+ utils::internal::initTransactionServerResponse(transaction);
+ utils::internal::initTransactionClientResponse(transaction);
+
+ return;
+}
+
int
handleTransactionEvents(TSCont cont, TSEvent event, void *edata)
{
@@ -61,19 +73,14 @@ handleTransactionEvents(TSCont cont, TSEvent event, void *edata)
(void)TSHttpTxnClientReqGet(static_cast<TSHttpTxn>(transaction.getAtsHandle()), &hdr_buf, &hdr_loc);
break;
case TS_EVENT_HTTP_SEND_REQUEST_HDR:
- utils::internal::initTransactionServerRequest(transaction);
- break;
case TS_EVENT_HTTP_READ_RESPONSE_HDR:
- utils::internal::initTransactionServerResponse(transaction);
- break;
case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
- utils::internal::initTransactionClientResponse(transaction);
- break;
case TS_EVENT_HTTP_READ_CACHE_HDR:
- utils::internal::initTransactionCachedRequest(transaction);
- utils::internal::initTransactionCachedResponse(transaction);
+ // the buffer handles may be destroyed in the core during redirect follow
+ initTransactionHandles(transaction);
break;
case TS_EVENT_HTTP_TXN_CLOSE: { // opening scope to declare plugins variable below
+ initTransactionHandles(transaction);
const std::list<TransactionPlugin *> &plugins = utils::internal::getTransactionPlugins(transaction);
for (std::list<TransactionPlugin *>::const_iterator iter = plugins.begin(), end = plugins.end(); iter != end; ++iter) {
shared_ptr<Mutex> trans_mutex = utils::internal::getTransactionPluginMutex(**iter);
[4/4] trafficserver git commit: [TS-4135] made reset implicit to init
for request/response
Posted by su...@apache.org.
[TS-4135] made reset implicit to init for request/response
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/74d8bb48
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/74d8bb48
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/74d8bb48
Branch: refs/heads/master
Commit: 74d8bb48381393075ae82a7deedb384937b1c285
Parents: 919de4c
Author: Sandeep Davu <sd...@sniffcliff.corp.ne1.yahoo.com>
Authored: Fri Jan 29 23:39:22 2016 +0000
Committer: Sudheer Vinukonda <su...@yahoo-inc.com>
Committed: Mon Feb 1 18:03:18 2016 +0000
----------------------------------------------------------------------
lib/atscppapi/src/Request.cc | 4 +++
lib/atscppapi/src/Response.cc | 4 +++
lib/atscppapi/src/Transaction.cc | 58 +++++++++++------------------------
3 files changed, 26 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/74d8bb48/lib/atscppapi/src/Request.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Request.cc b/lib/atscppapi/src/Request.cc
index 714ac93..5eea763 100644
--- a/lib/atscppapi/src/Request.cc
+++ b/lib/atscppapi/src/Request.cc
@@ -84,6 +84,10 @@ Request::Request(const string &url_str, HttpMethod method, HttpVersion version)
void
Request::init(void *hdr_buf, void *hdr_loc)
{
+ reset();
+ if (!hdr_buf || !hdr_loc) {
+ return;
+ }
state_->hdr_buf_ = static_cast<TSMBuffer>(hdr_buf);
state_->hdr_loc_ = static_cast<TSMLoc>(hdr_loc);
state_->headers_.reset(state_->hdr_buf_, state_->hdr_loc_);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/74d8bb48/lib/atscppapi/src/Response.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Response.cc b/lib/atscppapi/src/Response.cc
index 823986f..50da522 100644
--- a/lib/atscppapi/src/Response.cc
+++ b/lib/atscppapi/src/Response.cc
@@ -48,6 +48,10 @@ Response::Response()
void
Response::init(void *hdr_buf, void *hdr_loc)
{
+ reset();
+ if (!hdr_buf || !hdr_loc) {
+ return;
+ }
state_->hdr_buf_ = static_cast<TSMBuffer>(hdr_buf);
state_->hdr_loc_ = static_cast<TSMLoc>(hdr_loc);
state_->headers_.reset(state_->hdr_buf_, state_->hdr_loc_);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/74d8bb48/lib/atscppapi/src/Transaction.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc
index 3f1b0a8..1f7cd22 100644
--- a/lib/atscppapi/src/Transaction.cc
+++ b/lib/atscppapi/src/Transaction.cc
@@ -431,68 +431,46 @@ void
Transaction::initServerRequest()
{
static initializeHandles initializeServerRequestHandles(TSHttpTxnServerReqGet);
- if (initializeServerRequestHandles(state_->txn_, state_->server_request_hdr_buf_, state_->server_request_hdr_loc_,
- "server request")) {
- LOG_DEBUG("Initializing server request");
- state_->server_request_.init(state_->server_request_hdr_buf_, state_->server_request_hdr_loc_);
- } else {
- LOG_DEBUG("Reset server request");
- state_->server_request_.reset();
- }
+ initializeServerRequestHandles(state_->txn_, state_->server_request_hdr_buf_, state_->server_request_hdr_loc_, "server request");
+ LOG_DEBUG("Initializing server request");
+ state_->server_request_.init(state_->server_request_hdr_buf_, state_->server_request_hdr_loc_);
}
void
Transaction::initServerResponse()
{
static initializeHandles initializeServerResponseHandles(TSHttpTxnServerRespGet);
- if (initializeServerResponseHandles(state_->txn_, state_->server_response_hdr_buf_, state_->server_response_hdr_loc_,
- "server response")) {
- LOG_DEBUG("Initializing server response");
- state_->server_response_.init(state_->server_response_hdr_buf_, state_->server_response_hdr_loc_);
- } else {
- LOG_DEBUG("Reset server response");
- state_->server_response_.reset();
- }
+ initializeServerResponseHandles(state_->txn_, state_->server_response_hdr_buf_, state_->server_response_hdr_loc_,
+ "server response");
+ LOG_DEBUG("Initializing server response");
+ state_->server_response_.init(state_->server_response_hdr_buf_, state_->server_response_hdr_loc_);
}
void
Transaction::initClientResponse()
{
static initializeHandles initializeClientResponseHandles(TSHttpTxnClientRespGet);
- if (initializeClientResponseHandles(state_->txn_, state_->client_response_hdr_buf_, state_->client_response_hdr_loc_,
- "client response")) {
- LOG_DEBUG("Initializing client response");
- state_->client_response_.init(state_->client_response_hdr_buf_, state_->client_response_hdr_loc_);
- } else {
- LOG_DEBUG("Reset client response");
- state_->client_response_.reset();
- }
+ initializeClientResponseHandles(state_->txn_, state_->client_response_hdr_buf_, state_->client_response_hdr_loc_,
+ "client response");
+ LOG_DEBUG("Initializing client response");
+ state_->client_response_.init(state_->client_response_hdr_buf_, state_->client_response_hdr_loc_);
}
void
Transaction::initCachedRequest()
{
static initializeHandles initializeCachedRequestHandles(TSHttpTxnCachedReqGet);
- if (initializeCachedRequestHandles(state_->txn_, state_->cached_request_hdr_buf_, state_->cached_request_hdr_loc_,
- "cached request")) {
- LOG_DEBUG("Initializing cached request");
- state_->cached_request_.init(state_->cached_request_hdr_buf_, state_->cached_request_hdr_loc_);
- } else {
- LOG_DEBUG("Reset cached request");
- state_->cached_request_.reset();
- }
+ initializeCachedRequestHandles(state_->txn_, state_->cached_request_hdr_buf_, state_->cached_request_hdr_loc_, "cached request");
+ LOG_DEBUG("Initializing cached request");
+ state_->cached_request_.init(state_->cached_request_hdr_buf_, state_->cached_request_hdr_loc_);
}
void
Transaction::initCachedResponse()
{
static initializeHandles initializeCachedResponseHandles(TSHttpTxnCachedRespGet);
- if (initializeCachedResponseHandles(state_->txn_, state_->cached_response_hdr_buf_, state_->cached_response_hdr_loc_,
- "cached response")) {
- LOG_DEBUG("Initializing cached response");
- state_->cached_response_.init(state_->cached_response_hdr_buf_, state_->cached_response_hdr_loc_);
- } else {
- LOG_DEBUG("Reset cached response");
- state_->cached_response_.reset();
- }
+ initializeCachedResponseHandles(state_->txn_, state_->cached_response_hdr_buf_, state_->cached_response_hdr_loc_,
+ "cached response");
+ LOG_DEBUG("Initializing cached response");
+ state_->cached_response_.init(state_->cached_response_hdr_buf_, state_->cached_response_hdr_loc_);
}
[3/4] trafficserver git commit: [TS-4135] reset handles to null if
getter fails
Posted by su...@apache.org.
[TS-4135] reset handles to null if getter fails
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/919de4cc
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/919de4cc
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/919de4cc
Branch: refs/heads/master
Commit: 919de4cc8daa5ee739aa7993b9de59dd72530ee0
Parents: ef31c38
Author: Sandeep Davu <sd...@sniffcliff.corp.ne1.yahoo.com>
Authored: Fri Jan 29 20:48:02 2016 +0000
Committer: Sudheer Vinukonda <su...@yahoo-inc.com>
Committed: Mon Feb 1 18:03:17 2016 +0000
----------------------------------------------------------------------
lib/atscppapi/src/Request.cc | 10 ++++++++++
lib/atscppapi/src/Response.cc | 9 +++++++++
lib/atscppapi/src/Transaction.cc | 15 +++++++++++++++
lib/atscppapi/src/include/atscppapi/Request.h | 1 +
lib/atscppapi/src/include/atscppapi/Response.h | 1 +
5 files changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/919de4cc/lib/atscppapi/src/Request.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Request.cc b/lib/atscppapi/src/Request.cc
index 250f4f5..714ac93 100644
--- a/lib/atscppapi/src/Request.cc
+++ b/lib/atscppapi/src/Request.cc
@@ -97,6 +97,16 @@ Request::init(void *hdr_buf, void *hdr_loc)
}
}
+void
+Request::reset()
+{
+ state_->hdr_buf_ = NULL;
+ state_->hdr_loc_ = NULL;
+ state_->headers_.reset(NULL, NULL);
+ state_->url_loc_ = NULL;
+ LOG_DEBUG("Reset request %p", this);
+}
+
HttpMethod
Request::getMethod() const
{
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/919de4cc/lib/atscppapi/src/Response.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Response.cc b/lib/atscppapi/src/Response.cc
index b60d4f1..823986f 100644
--- a/lib/atscppapi/src/Response.cc
+++ b/lib/atscppapi/src/Response.cc
@@ -54,6 +54,15 @@ Response::init(void *hdr_buf, void *hdr_loc)
LOG_DEBUG("Initializing response %p with hdr_buf=%p and hdr_loc=%p", this, state_->hdr_buf_, state_->hdr_loc_);
}
+void
+Response::reset()
+{
+ state_->hdr_buf_ = NULL;
+ state_->hdr_loc_ = NULL;
+ state_->headers_.reset(NULL, NULL);
+ LOG_DEBUG("Reset response %p", this);
+}
+
HttpVersion
Response::getVersion() const
{
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/919de4cc/lib/atscppapi/src/Transaction.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/Transaction.cc b/lib/atscppapi/src/Transaction.cc
index 8790c00..3f1b0a8 100644
--- a/lib/atscppapi/src/Transaction.cc
+++ b/lib/atscppapi/src/Transaction.cc
@@ -435,6 +435,9 @@ Transaction::initServerRequest()
"server request")) {
LOG_DEBUG("Initializing server request");
state_->server_request_.init(state_->server_request_hdr_buf_, state_->server_request_hdr_loc_);
+ } else {
+ LOG_DEBUG("Reset server request");
+ state_->server_request_.reset();
}
}
@@ -446,6 +449,9 @@ Transaction::initServerResponse()
"server response")) {
LOG_DEBUG("Initializing server response");
state_->server_response_.init(state_->server_response_hdr_buf_, state_->server_response_hdr_loc_);
+ } else {
+ LOG_DEBUG("Reset server response");
+ state_->server_response_.reset();
}
}
@@ -457,6 +463,9 @@ Transaction::initClientResponse()
"client response")) {
LOG_DEBUG("Initializing client response");
state_->client_response_.init(state_->client_response_hdr_buf_, state_->client_response_hdr_loc_);
+ } else {
+ LOG_DEBUG("Reset client response");
+ state_->client_response_.reset();
}
}
@@ -468,6 +477,9 @@ Transaction::initCachedRequest()
"cached request")) {
LOG_DEBUG("Initializing cached request");
state_->cached_request_.init(state_->cached_request_hdr_buf_, state_->cached_request_hdr_loc_);
+ } else {
+ LOG_DEBUG("Reset cached request");
+ state_->cached_request_.reset();
}
}
@@ -479,5 +491,8 @@ Transaction::initCachedResponse()
"cached response")) {
LOG_DEBUG("Initializing cached response");
state_->cached_response_.init(state_->cached_response_hdr_buf_, state_->cached_response_hdr_loc_);
+ } else {
+ LOG_DEBUG("Reset cached response");
+ state_->cached_response_.reset();
}
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/919de4cc/lib/atscppapi/src/include/atscppapi/Request.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Request.h b/lib/atscppapi/src/include/atscppapi/Request.h
index bfe1b0a..25ab332 100644
--- a/lib/atscppapi/src/include/atscppapi/Request.h
+++ b/lib/atscppapi/src/include/atscppapi/Request.h
@@ -65,6 +65,7 @@ private:
Request(void *hdr_buf, void *hdr_loc);
RequestState *state_;
void init(void *hdr_buf, void *hdr_loc);
+ void reset();
friend class Transaction;
friend class ClientRequest;
};
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/919de4cc/lib/atscppapi/src/include/atscppapi/Response.h
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/include/atscppapi/Response.h b/lib/atscppapi/src/include/atscppapi/Response.h
index 5b8582d..741d709 100644
--- a/lib/atscppapi/src/include/atscppapi/Response.h
+++ b/lib/atscppapi/src/include/atscppapi/Response.h
@@ -67,6 +67,7 @@ public:
private:
ResponseState *state_;
void init(void *hdr_buf, void *hdr_loc);
+ void reset();
friend class Transaction;
friend class utils::internal;
};