hashicorp / hashicorp/consul

multiple clients acquired lock at same time when network problem happen

Open
#8,736 2 comments 0 reactions 1 assignee Claimed by @mkcp View on GitHub
theme/internals type/bug
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

#### Overview of the Issue

Multiple clients can get lock at same time when network sucks.

#### Reproduction Steps

Steps to reproduce this issue:

1. Use golang SDK to connect consul servers, client **A** acquired lock called **L**
1. When network between client and consul servers is happened, lock **L** session is invalid
1. Now client **B** can acquire this lock
1. But client **A** still have lock **L** because of network problem, `monitorLock` cann't receive any change.

#### Reason and Solution

When client use blocking queries, wait duration is handled by server. Maybe client can use a deadline context for blocking queries.

Related code below:
https://github.com/hashicorp/consul/blob/e4507ae11ed8804cbfaf1511573d865e209ce720/api/lock.go#L378-L408

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.