Skip to content

Commit

Permalink
add more logs to debug the assert failure problem for freshchat iter1
Browse files Browse the repository at this point in the history
  • Loading branch information
dinesh-murugiah committed Nov 30, 2024
1 parent 4db4a88 commit 25c8d3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ SplitRequestPtr PubSubRequest::create(Router& router, Common::Redis::RespValuePt

if (Common::Redis::SupportedCommands::subscriptionCommands().contains(command_name) && incoming_request->asArray().size() < 2) {
if (!Common::Redis::SupportedCommands::subcrStateNoArgallowedCommands().contains(command_name)) {
ENVOY_LOG(debug, "Invalid request: '{}'", incoming_request->toString());
ENVOY_LOG(error, " PubSubRequest::create - Invalid request: '{}'", incoming_request->toString());
callbacks.onResponse(Common::Redis::Utility::makeError(Response::get().InvalidRequest));
return nullptr;
} else {
Expand Down Expand Up @@ -1000,6 +1000,7 @@ SplitRequestPtr PubSubRequest::create(Router& router, Common::Redis::RespValuePt
if (transaction.active_) {
if (transaction.isSubscribedMode()) {
if (!Common::Redis::SupportedCommands::subcrStateallowedCommands().contains(command_name)) {
ENVOY_LOG(error, "Not supported command in subscribe state: '{}'", command_name);
callbacks.onResponse(Common::Redis::Utility::makeError("Not supported command in subscribe state"));
return nullptr;
} else if (command_name == "quit") {
Expand All @@ -1010,6 +1011,7 @@ SplitRequestPtr PubSubRequest::create(Router& router, Common::Redis::RespValuePt
return nullptr;
}
} else if (transaction.isTransactionMode()) {
ENVOY_LOG(error, "PUBUSB Not supported when in transaction mode: '{}'", command_name);
callbacks.onResponse(
Common::Redis::Utility::makeError("Not supported when in transaction mode"));
transaction.should_close_ = true;
Expand All @@ -1025,7 +1027,7 @@ SplitRequestPtr PubSubRequest::create(Router& router, Common::Redis::RespValuePt
transaction.enterSubscribedMode();
transaction.start();
}else{
ENVOY_LOG(info, "not yet in subscription mode, must be in subscr mode first: '{}'", command_name);
ENVOY_LOG(error, "not yet in subscription mode, must be in subscr mode first: '{}'", command_name);
callbacks.onResponse(Common::Redis::Utility::makeError(fmt::format("not yet in subcribe mode")));
return nullptr;
}
Expand Down Expand Up @@ -1066,7 +1068,7 @@ SplitRequestPtr PubSubRequest::create(Router& router, Common::Redis::RespValuePt

for (int32_t i = 0; i < redisShardsCount; i++) {
if (!makeRequest(i, base_request)){
ENVOY_LOG(info,"makerequest failed for allShardsRequest for shardIndex'{}'",i);
ENVOY_LOG(error,"makerequest failed for allShardsRequest for shardIndex'{}'",i);
transaction.setPubSubCallback(nullptr);
return nullptr;
}
Expand All @@ -1093,14 +1095,14 @@ SplitRequestPtr PubSubRequest::create(Router& router, Common::Redis::RespValuePt
for (int32_t i = 0; i < redisShardsCount; i++) {
if (i == transaction.subscribed_client_shard_index_){
if (!makeRequest(i, base_request)){
ENVOY_LOG(info,"makerequest failed for allShardwithSingleShardRequest for base request at shardIndex'{}'",i);
ENVOY_LOG(error,"makerequest failed for allShardwithSingleShardRequest for base request at shardIndex'{}'",i);
transaction.setPubSubCallback(nullptr);
return nullptr;
}

}else{
if (!makeRequest(i, keyspaceRequest)){
ENVOY_LOG(info,"makerequest failed for allShardwithSingleShardRequest for keyspaceRequest at shardIndex'{}'",i);
ENVOY_LOG(error,"makerequest failed for allShardwithSingleShardRequest for keyspaceRequest at shardIndex'{}'",i);
transaction.setPubSubCallback(nullptr);
return nullptr;
}
Expand Down
4 changes: 4 additions & 0 deletions source/extensions/filters/network/redis_proxy/proxy_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ void ProxyFilter::onResponse(PendingRequest& request, Common::Redis::RespValuePt
return;
}

if (request.pending_response_.get()->type() != Common::Redis::RespType::Null && transaction_.isSubscribedMode()){
ENVOY_LOG(error,"Non null response received for pubsub command: : '{}' ",request.pending_response_->toString());
}

if (request.pending_response_) {
if (request.pending_response_->type() != Common::Redis::RespType::Null &&request.pending_response_->type() == Common::Redis::RespType::Error) {
ENVOY_LOG(info, "error response: '{}'", request.pending_response_->toString());
Expand Down

0 comments on commit 25c8d3a

Please sign in to comment.