This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 7.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 89f7dba72f540d228c5d59acfb853ca379ef19eb Author: Fei Deng <[email protected]> AuthorDate: Wed Mar 28 09:57:42 2018 -0500 potential traffic_cop crash due to leftover data in socket (cherry picked from commit efd4006e5ea7a0e6c2da10a2231bea57c6b58a91) --- 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 caf57ad..e158a04 100644 --- a/mgmt/api/CoreAPIRemote.cc +++ b/mgmt/api/CoreAPIRemote.cc @@ -619,8 +619,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 [email protected].
