Fix loss of message after invalidating previous message in queue with single broadcast message#263
Open
pstibrany wants to merge 1 commit intohashicorp:masterfrom
Open
Fix loss of message after invalidating previous message in queue with single broadcast message#263pstibrany wants to merge 1 commit intohashicorp:masterfrom
pstibrany wants to merge 1 commit intohashicorp:masterfrom
Conversation
… single broadcast.
pracucci
approved these changes
Jul 14, 2022
pracucci
left a comment
There was a problem hiding this comment.
I was part of this investigation and I confirm that avoiding resetting the idGen solves the issue. Since the queueBroadcast() already deals with the wrap around, I don't see any need to reset idGen to 0 to keep it low.
|
A clarification: the
Given two items, if none of the two is less than the other, then they're considered equal by the btree implementation, and the |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have found a condition where message can get overwritten in the
TransmitLimitedQueue. This PR fixes it.Message can be lost in scenario where queue has a single message in it, and then another message, which invalidates previous message, is added to the queue. During invalidation the old message is removed and the queue is temporarily empty. At that point internal
idGenvalue was reset to 0. However new message is then added to the queue withidcomputed from previous value ofidGen.If later more messages are added to the queue, new message can overwrite existing message in the queue, because of conflicting
idand exact same length. See the unit test for exact scenario we have observed in our system.Simplest fix seems to be to avoid resetting the
idGenwhen queue is empty. Alternative fix may adjustidof inserted message ifidGenwas reset during invalidation of other messages in(*TransmitLimitedQueue).queueBroadcast, or pass a flag to(*TransmitLimitedQueue).deleteItemto indicate if reset ofidGenshould be done or not.