Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cluster): possible distributed deadlock when two nodes close input at same time #10154

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/query/service/src/api/rpc/flight_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ impl ClientFlightExchange {
}

pub async fn close_input(&self) {
// Close local channel first.
// NOTE: this is very important. When we open the local channel while pushing closing input, it may cause distributed deadlock.
self.request_rx.close();

// Notify remote not to send messages.
// We send it directly to the network channel avoid response channel is closed
if let Some(network_tx) = self.network_tx.upgrade() {
Expand Down Expand Up @@ -535,6 +539,10 @@ impl ServerFlightExchange {
}

pub async fn close_input(&self) {
// Close local channel first.
// NOTE: this is very important. When we open the local channel while pushing closing input, it may cause distributed deadlock.
self.request_rx.close();

// Notify remote not to send messages.
// We send it directly to the network channel avoid response channel is closed
if let Some(network_tx) = self.network_tx.upgrade() {
Expand Down