Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

cluster: race condition in raft/cluster #67

Open
SUMUKHA-PK opened this issue Oct 26, 2020 · 1 comment
Open

cluster: race condition in raft/cluster #67

SUMUKHA-PK opened this issue Oct 26, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@SUMUKHA-PK
Copy link
Member

Describe the bug
The raft/cluster package has a message queue channel which passes on the incoming messages through it like this:

c.messages <- incomingPayload{
			origin:  conn,
			payload: data,
		}

This channel when closed asynchronously from its parent function leads to a race condition.

To Reproduce
Reproduced while cluster.Close() is called, in the raft branch.

Expected behavior
Race conditions must not exist, ever!

Screenshots
Screenshot 2020-10-26 at 4 52 11 PM

@SUMUKHA-PK SUMUKHA-PK added the bug Something isn't working label Oct 26, 2020
@SUMUKHA-PK SUMUKHA-PK self-assigned this Oct 26, 2020
@SUMUKHA-PK
Copy link
Member Author

Solved using a select in the sending phase. Check for a close signal and close if that exists, else send the messages.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant