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

[Question] serf initial PushPull messages delivered out of order #448

Open
sanimej opened this issue Feb 6, 2017 · 1 comment
Open

[Question] serf initial PushPull messages delivered out of order #448

sanimej opened this issue Feb 6, 2017 · 1 comment
Labels

Comments

@sanimej
Copy link

sanimej commented Feb 6, 2017

In Docker Overlay network we use serf to exchange the endpoint IP/mac across nodes. On restarting the Docker daemon on a node what I am seeing is that the user events from the initial TCP pushpull sync are delivered out of order. Its verifiable easily with theLTime from serf.UserEvent

As per this comment the client should get the events from EventCh in the right order
https://github.com/hashicorp/serf/blob/master/serf/config.go#L38

Is it guaranteed that the events are delivered in order and it could be bug here or are there factors that can introduce out of order delivery to the client (FWIW, we use a buffered channel for the events)

Since the interface up/down events are order sensitive its bit of a mess when we get the events in incorrect order.

@slackpad
Copy link
Contributor

slackpad commented Feb 7, 2017

Hi @sanimej I think it is possible that they end up out of order during a push-pull. The storage of events into the buffer is here:

https://github.com/hashicorp/serf/blob/master/serf/serf.go#L1131-L1144

That idx calculation ends up working kind of like a ring buffer, so you might end up with some newer events at the front if things wrap around. I think to fix this you'd want to change the code here:

https://github.com/hashicorp/serf/blob/master/serf/delegate.go#L262-L274

If you sort by LTime it should process them in the proper temporal order, not in the order they happened to be in the buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants