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

Prevent race condition in ResponseTracker by using entry which holds the lock #1532

Merged
merged 1 commit into from
May 22, 2024

Conversation

tillrohrmann
Copy link
Contributor

@tillrohrmann tillrohrmann commented May 19, 2024

This commit resolves the race condition in the ResponseTracer when creating a new token with an existing correlation id and completing the very same correlation id at the same time. The solution is to use the entry method of Dashmap which keeps the lock as long as entry is not dropped.

This fixes #1531.

@tillrohrmann tillrohrmann changed the title Prevent race condition in ResponseTracker by using entry which holds … Prevent race condition in ResponseTracker by using entry which holds the lock May 19, 2024
Copy link
Contributor

@AhmedSoliman AhmedSoliman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks for addressing this. I just found that you have suggested that after I merged my PR. Great stuff!

@AhmedSoliman
Copy link
Contributor

A note for posterity, we are effectively not vulnerable to this at the moment since all current uses rely on RequestId which is a local atomic counter.

…the lock

This commit resolves the race condition in the ResponseTracer when creating a new
token with an existing correlation id and completing the very same correlation id
at the same time. The solution is to use the entry method of Dashmap which keeps the
lock as long as entry is not dropped.

This fixes restatedev#1531.
@tillrohrmann tillrohrmann merged commit abed7e0 into restatedev:main May 22, 2024
3 checks passed
@tillrohrmann tillrohrmann deleted the issues/1531 branch May 22, 2024 12:04
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.

Race condition in ResponseTracker
2 participants