Skip to content

Commit

Permalink
fix: Do not use cc_ in connection if it's null (#4131)
Browse files Browse the repository at this point in the history
* fix: Do not use `cc_` in connection if it's null

This is a rare condition, which we know can happen during shutdown (see
[here](#3873 (comment)))

* add comment
  • Loading branch information
chakaz authored Nov 14, 2024
1 parent ab6088f commit f04e549
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/facade/dragonfly_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1428,20 +1428,25 @@ std::string Connection::DebugInfo() const {

absl::StrAppend(&info, "address=", uint64_t(this), ", ");
absl::StrAppend(&info, "phase=", phase_, ", ");
absl::StrAppend(&info, "dispatch(s/a)=", cc_->sync_dispatch, " ", cc_->async_dispatch, ", ");
absl::StrAppend(&info, "closing=", cc_->conn_closing, ", ");
if (cc_) {
// In some rare cases cc_ can be null, see https://github.com/dragonflydb/dragonfly/pull/3873
absl::StrAppend(&info, "dispatch(s/a)=", cc_->sync_dispatch, " ", cc_->async_dispatch, ", ");
absl::StrAppend(&info, "closing=", cc_->conn_closing, ", ");
}
absl::StrAppend(&info, "dispatch_fiber:joinable=", dispatch_fb_.IsJoinable(), ", ");

bool intrusive_front = dispatch_q_.size() > 0 && dispatch_q_.front().IsControl();
absl::StrAppend(&info, "dispatch_queue:size=", dispatch_q_.size(), ", ");
absl::StrAppend(&info, "dispatch_queue:pipelined=", pending_pipeline_cmd_cnt_, ", ");
absl::StrAppend(&info, "dispatch_queue:intrusive=", intrusive_front, ", ");

absl::StrAppend(&info, "state=");
if (cc_->paused)
absl::StrAppend(&info, "p");
if (cc_->blocked)
absl::StrAppend(&info, "b");
if (cc_) {
absl::StrAppend(&info, "state=");
if (cc_->paused)
absl::StrAppend(&info, "p");
if (cc_->blocked)
absl::StrAppend(&info, "b");
}

absl::StrAppend(&info, "}");
return info;
Expand Down

0 comments on commit f04e549

Please sign in to comment.