-
Notifications
You must be signed in to change notification settings - Fork 143
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
fix: (mod-service)Use concurrent read cache #10965
Conversation
Signed-off-by: Michael Tinker <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #10965 +/- ##
=============================================
+ Coverage 63.26% 63.27% +0.01%
- Complexity 31301 31315 +14
=============================================
Files 3390 3390
Lines 137447 137483 +36
Branches 14405 14405
=============================================
+ Hits 86951 86996 +45
+ Misses 46906 46901 -5
+ Partials 3590 3586 -4 ☔ View full report in Codecov by Sentry. |
Node: E2E Test Results 1 files ± 0 1 suites ±0 23m 54s ⏱️ + 23m 54s Results for commit fa478b2. ± Comparison against base commit cca3e1c. This pull request removes 1 and adds 311 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, ty @Neeharika-Sompalli !
Signed-off-by: Michael Tinker <[email protected]> Co-authored-by: Michael Tinker <[email protected]> Signed-off-by: Timo Brandstätter <[email protected]>
Root cause is the use of a HashMap readCache in ReadableKVStateBase results a race between (1) thread A that is trying to get an already-read key and (2) thread B that is trying to add a newly-read key and hence resizing the HashMap. This can lead to ISS.
To solve the issue used
ConcurrentHashMap
orSynchronizedMap
instead ofHashMap
for readCache. Since we want to store null values in readCache if the entity doesn't exist in state, andConcurrentHashMap
doesn't allow null values decided to useSynchronizedMap
.This will be changed to use a Marker object instead of null value in the future based on performance testing.