[fix][ml] Fix race conditions in RangeCache#22789
Merged
merlimat merged 7 commits intoMay 31, 2024
Merged
Conversation
3 tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #22789 +/- ##
============================================
- Coverage 73.57% 73.27% -0.31%
- Complexity 32624 32648 +24
============================================
Files 1877 1889 +12
Lines 139502 141659 +2157
Branches 15299 15543 +244
============================================
+ Hits 102638 103800 +1162
- Misses 28908 29844 +936
- Partials 7956 8015 +59
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Technoboy-
reviewed
May 30, 2024
lhotari
marked this pull request as draft
May 30, 2024 20:05
lhotari
marked this pull request as ready for review
May 30, 2024 21:06
Member
Author
Member
Author
|
This PR contained a few issues. I have a follow up PR #22814 to address the issues. Please review |
lhotari
added a commit
that referenced
this pull request
Jun 3, 2024
(cherry picked from commit c39f9f8)
lhotari
added a commit
that referenced
this pull request
Jun 3, 2024
(cherry picked from commit c39f9f8)
lhotari
added a commit
that referenced
this pull request
Jun 3, 2024
(cherry picked from commit c39f9f8)
3 tasks
Merged
4 tasks
hanmz
pushed a commit
to hanmz/pulsar
that referenced
this pull request
Feb 12, 2025
Merged
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.
Motivation
The RangeCache class contains several race conditions which cause instability.
When one thread removes the entry and another one uses it, that will become a problem.
The
cacheEvictionIntervalMssetting is 10 ms by default. This results in theRangeCache.evictLEntriesBeforeTimestampmethod getting called about 100 times per second.The default expiration is
managedLedgerCacheEvictionTimeThresholdMilliswhich is 1000 ms by default.It's also possible that 2 threads remove the entry at the same time.
ManagedLedgerImpl.invalidateEntriesUpToSlowestReaderPositionwill result in calls toRangeCache.removeRangemethod. These calls happen independently of theRangeCache.evictLEntriesBeforeTimestampcalls so there's a chance for race conditions.Modifications
.retain()and.release()callsremove(key, value)method so that removals remove the correct value exactly onceDocumentation
docdoc-requireddoc-not-neededdoc-complete