hashicorp / hashicorp/memberlist
Clarify that it is not safe to call any of the methods of the Memberlist type inside the EventDelegate methods.
- Dominant language
- Go
- Stars
- 4.1k
- Forks
- 478
- Avg merge
- 15h 58m
- Merged PRs (30d)
- 3
Description
The problem I'm experiencing is that I call `Memberlist.Members()` inside the `NotifyLeave` delegate of that memberlist. This will block everything on the `Memberlist.nodeLock`.
My instance was waiting in the following places, I didn't have enough time to look for where the lock was actually held.
https://github.com/hashicorp/memberlist/blob/master/memberlist.go#L403
https://github.com/hashicorp/memberlist/blob/master/state.go#L298
https://github.com/hashicorp/memberlist/blob/master/state.go#L168
Contributor guide
Research direction
Start with the Memberlist and EventDelegate references in memberlist.go and state.go at the linked lines, then trace how nodeLock is held during delegate callbacks. Update the relevant public documentation to state whether Memberlist methods are safe inside EventDelegate methods, including the blocking behavior described. Done means the restriction and its consequence are explicit and easy to find.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100