hashicorp / hashicorp/serf

Serf.SetTags can race with itself

Open
#621 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.1k
Forks
609
Avg merge
15h 1m
Merged PRs (30d)
3

Description

The godoc for the `Serf` struct says "All functions on the Serf structure are safe to call concurrently", but https://github.com/hashicorp/consul/issues/9457 shows this is not true of `SetTags`. It updates a map without acquiring a lock.

Should there be a lock for accessing `Serf.config` ? Or should the godoc be updated to say that the caller is responsible for locking? Since the caller will need to synchronize the calls to get tags and set tags, it may be appropriate to leave the locking to the caller.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting Serf.SetTags and the Serf struct godoc, then review how Serf.config is accessed and the race described in consul#9457. Determine whether synchronization belongs inside SetTags or whether the concurrency contract should be revised. Done means the chosen behavior is implemented or documented consistently with the API contract, with the race addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.