[CELEBORN-2276] Fix race condition in MemoryManager.releaseSortMemory#3620
Open
cxzl25 wants to merge 1 commit intoapache:mainfrom
Open
[CELEBORN-2276] Fix race condition in MemoryManager.releaseSortMemory#3620cxzl25 wants to merge 1 commit intoapache:mainfrom
cxzl25 wants to merge 1 commit intoapache:mainfrom
Conversation
eolivelli
suggested changes
Mar 9, 2026
Contributor
eolivelli
left a comment
There was a problem hiding this comment.
The change looks good
can you please add dedicated unit tests around this piece of code ?
it would be great to have a test that updates the counter using reserveSortMemory and releaseSortMemory from different threads to demostrate the bug and the fix
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3620 +/- ##
==========================================
- Coverage 67.13% 66.88% -0.24%
==========================================
Files 357 357
Lines 21860 21967 +107
Branches 1943 1949 +6
==========================================
+ Hits 14674 14691 +17
- Misses 6166 6262 +96
+ Partials 1020 1014 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
What changes were proposed in this pull request?
Use
updateAndGetWhy are the changes needed?
reserveSortMemorycallssortMemoryCounter.addAndGetwithout any synchronized, so the lock inreleaseSortMemorydoesn't actually protect against races withreserveSortMemoryanyway.Does this PR resolve a correctness bug?
No
Does this PR introduce any user-facing change?
No
How was this patch tested?
GHA