Skip to content

Fixed memory leak on a race between adding/removing from lock-free list #1845

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

Merged
merged 1 commit into from
Mar 6, 2020

Conversation

elizarov
Copy link
Contributor

@elizarov elizarov commented Mar 5, 2020

  • The problem was introduced by Simpler and faster lock-free linked list #1565. When doing concurrent add+removeFirst the following can happen:
    • "add" completes, but has not correct prev pointer in next node yet
    • "removeFirst" removes freshly added element
    • "add" performs "finishAdd" that adjust prev pointer of the next node and thus removed element is pointed from the list again
  • A separate LockFreeLinkedListAddRemoveStressTest is added that reproduces this problem.
  • The old LockFreeLinkedListAtomicLFStressTest is refactored a bit.

* The problem was introduced by #1565. When doing concurrent add+removeFirst the following can happen:
  - "add" completes, but has not correct prev pointer in next node yet
  - "removeFirst" removes freshly added element
  - "add" performs "finishAdd" that adjust prev pointer of the next node and thus removed element is pointed from the list again
* A separate LockFreeLinkedListAddRemoveStressTest is added that reproduces this problem.
* The old LockFreeLinkedListAtomicLFStressTest is refactored a bit.
@elizarov elizarov requested a review from qwwdfsad March 5, 2020 15:40
@qwwdfsad qwwdfsad merged commit 7df61ee into develop Mar 6, 2020
@qwwdfsad qwwdfsad deleted the list-add-remove branch March 6, 2020 09:23
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.

2 participants