Skip to content

Commit

Permalink
remove assert and add logs when response received after request flushed
Browse files Browse the repository at this point in the history
  • Loading branch information
dinesh-murugiah committed Nov 14, 2024
1 parent f435e3a commit d50e8f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion source/extensions/filters/network/redis_proxy/proxy_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ void ProxyFilter::onEvent(Network::ConnectionEvent event) {
while (!pending_requests_.empty()) {
if (pending_requests_.front().request_handle_ != nullptr) {
pending_requests_.front().request_handle_->cancel();
}else{
ENVOY_LOG(error,"pending request handle is null");
}
pending_requests_.pop_front();
request_cancelled_=true;
}
if (event == Network::ConnectionEvent::RemoteClose){
ENVOY_LOG(debug,"dereferencing pubsub callback and transaction on exit from proxy filter");
Expand Down Expand Up @@ -246,7 +249,16 @@ void ProxyFilter::onPubsubConnClose(){
}

void ProxyFilter::onResponse(PendingRequest& request, Common::Redis::RespValuePtr&& value) {
ASSERT(!pending_requests_.empty());
//Commenting this out for Trackign an issue in freshchat where the pending_requests_ is empty but we get a response
//ASSERT(!pending_requests_.empty());
if (pending_requests_.empty()) {
ENVOY_LOG(error, "Received response:'{}' with no pending requests - discarding response",value->toString());
ENVOY_LOG(error, "cancel request '{}' when no pending requests",request_cancelled_?"true":"false");
if (request.request_handle_ != nullptr) {
request.request_handle_=nullptr;
}
return;
}
request.pending_response_ = std::move(value);
request.request_handle_ = nullptr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class ProxyFilter : public Network::ReadFilter,
bool connection_allowed_;
Common::Redis::Client::Transaction transaction_;
bool connection_quit_;
bool request_cancelled_{false};
std::string clientname_{};
};

Expand Down

0 comments on commit d50e8f3

Please sign in to comment.