Skip to content

Commit

Permalink
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

Change-Id: Ic691f8075f314e34254a94c7a9aea21b577f5524
  • Loading branch information
Megh Bhatt committed Oct 23, 2015
1 parent 6057324 commit 6786de5
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 @@ -231,7 +231,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 @@ -252,7 +256,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_UVE,
Expand Down
8 changes: 6 additions & 2 deletions src/query_engine/QEOpServerProxy.cc
Expand Up @@ -894,16 +894,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,
"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 6786de5

Please sign in to comment.