Skip to content

Commit

Permalink
Merge "Handle NULL redisReply in connect callback process in opserver…
Browse files Browse the repository at this point in the history
… proxy code. This can happen during read EOF resulting in redisAsyncFree calling the callbacks with NULL replies. Closes-Bug: #1499129" into R2.20
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 9, 2016
2 parents b709340 + 8fc52f6 commit 1430643
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/analytics/OpServerProxy.cc
Expand Up @@ -224,7 +224,11 @@ class OpServerProxy::OpServerImpl {
}

void toConnectCallbackProcess(const redisAsyncContext *c, void *r, void *privdata) {
//Handle the AUTH callback
if (r == NULL) {
LOG(DEBUG, "In toConnectCallbackProcess.. NULL Reply");
return;
}
// Handle the AUTH callback
redisReply reply = *reinterpret_cast<redisReply*>(r);
if (reply.type != REDIS_REPLY_ERROR) {
{
Expand All @@ -245,7 +249,11 @@ class OpServerProxy::OpServerImpl {
}

void fromConnectCallbackProcess(const redisAsyncContext *c, void *r, void *privdata) {
//Handle the AUTH callback
if (r == NULL) {
LOG(DEBUG, "In fromConnectCallbackProcess.. NULL Reply");
return;
}
// Handle the AUTH callback
redisReply reply = *reinterpret_cast<redisReply*>(r);
if (reply.type != REDIS_REPLY_ERROR) {
ConnectionState::GetInstance()->Update(ConnectionType::REDIS,
Expand Down
8 changes: 6 additions & 2 deletions src/query_engine/QEOpServerProxy.cc
Expand Up @@ -882,16 +882,20 @@ class QEOpServerProxy::QEOpServerImpl {
}

void ConnectCallbackProcess(uint8_t cnum, const redisAsyncContext *c, void *r, void *privdata) {
QE_LOG_NOQID(DEBUG,"In ConnectCallbackProcess..");
if (r == NULL) {
QE_LOG_NOQID(DEBUG, "In ConnectCallbackProcess.. NULL Reply");
return;
}
redisReply reply = *reinterpret_cast<redisReply*>(r);
if (reply.type != REDIS_REPLY_ERROR) {
QE_LOG_NOQID(DEBUG, "In ConnectCallbackProcess..");
ConnectionState::GetInstance()->Update(ConnectionType::REDIS,
"Query", ConnectionStatus::UP, conns_[cnum]->Endpoint(),
std::string());
qosp_->evm_->io_service()->post(
boost::bind(&QEOpServerImpl::ConnUpPostProcess,
this, cnum));
}else {
} else {
QE_LOG_NOQID(ERROR,"In connectCallbackProcess.. Error");
QE_ASSERT(reply.type != REDIS_REPLY_ERROR);
}
Expand Down

0 comments on commit 1430643

Please sign in to comment.