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

cmd/thanos/receive: avoid deadlock #1727

Merged
merged 1 commit into from
Nov 7, 2019
Merged

Conversation

squat
Copy link
Member

@squat squat commented Nov 6, 2019

While debugging #1721, I found that when thanos receive bails, there is
a race in a select statement, where the non-returning branch may be
chosen. This branch will deadlock if selected twice because the channel
reader has already exited. The way to prevent this is by checking if
we need to exit on every loop.

Signed-off-by: Lucas Servén Marín [email protected]

cc @brancz @bwplotka

While debugging thanos-io#1721, I found that when thanos receive bails, there is
a race in a select statement, where the non-returning branch may be
chosen. This branch will deadlock if selected twice because the channel
reader has already exited. The way to prevent this is by checking if
we need to exit on every loop.

Signed-off-by: Lucas Servén Marín <[email protected]>
@brancz
Copy link
Member

brancz commented Nov 7, 2019

Oops...

@brancz brancz merged commit 514f308 into thanos-io:master Nov 7, 2019
IKSIN pushed a commit to monitoring-tools/thanos that referenced this pull request Nov 26, 2019
While debugging thanos-io#1721, I found that when thanos receive bails, there is
a race in a select statement, where the non-returning branch may be
chosen. This branch will deadlock if selected twice because the channel
reader has already exited. The way to prevent this is by checking if
we need to exit on every loop.

Signed-off-by: Lucas Servén Marín <[email protected]>
Signed-off-by: Aleksey Sin <[email protected]>
IKSIN pushed a commit to monitoring-tools/thanos that referenced this pull request Nov 27, 2019
While debugging thanos-io#1721, I found that when thanos receive bails, there is
a race in a select statement, where the non-returning branch may be
chosen. This branch will deadlock if selected twice because the channel
reader has already exited. The way to prevent this is by checking if
we need to exit on every loop.

Signed-off-by: Lucas Servén Marín <[email protected]>
Signed-off-by: Aleksey Sin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants