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

[issues/3340] bugfix concurrency issues FluxReplay.Size/SizeAndTime #3714

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MikkelHJuul
Copy link

This change adds a bunch of tests and improves concurrency of the Size(AndTime)BoundReplayBuffers (I believe they will be able to run in unsafe-mode after this change). The user will not see any changes to the API.

This PR fixes the current replay buffers' issue with holding onto one too many items, as the head is reused (it is final) and will only point at the current Atomic linked list's head. In stead of it being the volatile reference that is being reassigned to roll over the linked list (but always only replaying head.get(); which leaked head.value).
This PR further fix an issue in the #add methods of both implementations that caused writes to be missed. The tail value was non-atomically read and written to, losing updates along the way.

See #3340.

finalize head and roll it over in stead of resetting head, this means the current head will always remain a value-null in stead of being reassigned.
I applied the fix for the TimeAndSizeBoundReplayBuffer
in add: `head.get().get()` concurrently could trigger null-pointer
also: tail was contested and the tail would be silently dropped on write
@MikkelHJuul MikkelHJuul requested a review from a team as a code owner February 6, 2024 11:08
if head does not roll over, the cache may grow beyond its limit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant