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

Conflicts:
	src/query_engine/QEOpServerProxy.cc

Change-Id: Ic691f8075f314e34254a94c7a9aea21b577f5524
(cherry picked from commit 6786de5)
  • Loading branch information
Megh Bhatt committed Feb 5, 2016
1 parent f3815df commit b62c8da
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 b62c8da

Please sign in to comment.