You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by du...@apache.org on 2018/04/02 16:17:34 UTC
[trafficserver] branch master updated: potential traffic_cop crash
due to leftover data in socket
This is an automated email from the ASF dual-hosted git repository.
duke8253 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new efd4006 potential traffic_cop crash due to leftover data in socket
efd4006 is described below
commit efd4006e5ea7a0e6c2da10a2231bea57c6b58a91
Author: Fei Deng <du...@gmail.com>
AuthorDate: Wed Mar 28 09:57:42 2018 -0500
potential traffic_cop crash due to leftover data in socket
---
mgmt/api/CoreAPIRemote.cc | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc
index a6250f0..8a9a509 100644
--- a/mgmt/api/CoreAPIRemote.cc
+++ b/mgmt/api/CoreAPIRemote.cc
@@ -654,8 +654,18 @@ MgmtRecordGet(const char *rec_name, TSRecordEle *rec_ele)
}
// create and send request
- ret = MGMTAPI_SEND_MESSAGE(main_socket_fd, OpType::RECORD_GET, &optype, &record);
- return (ret == TS_ERR_OKAY) ? mgmt_record_get_reply(OpType::RECORD_GET, rec_ele) : ret;
+ if ((ret = MGMTAPI_SEND_MESSAGE(main_socket_fd, OpType::RECORD_GET, &optype, &record)) != TS_ERR_OKAY) {
+ return ret;
+ }
+
+ // drop the response if the record name doesn't match
+ // we need to do this because there might be left over data on the socket
+ // when restarting traffic_server, even though it can't be recreated in a
+ // test environment, it has been observed in production the names doesn't
+ // match and caused traffic_cop to crash due to type mismatch.
+ while ((ret = mgmt_record_get_reply(OpType::RECORD_GET, rec_ele)) == TS_ERR_OKAY && strcmp(rec_name, rec_ele->rec_name) != 0) {
+ }
+ return ret;
}
TSMgmtError
--
To stop receiving notification emails like this one, please contact
duke8253@apache.org.