`EntityCache` leaks memory & prone to inconsistencies & race conditions
- Dominant language
- Java
- Stars
- 2.1k
- Forks
- 522
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 137
Description
### Describe the bug
`org.apache.polaris.core.persistence.cache.EntityCache` uses two containers:
```java
private final Cache byId;
private final AbstractMap byName;
```
The first one is a Caffeine cache, the second one is a Java Map.
`byName` can become inconsistent due to race conditions, multiple threads acting on the same entity IDs and/or entity names.
The implementation assumes, that there are no multi-threaded accesses against the same entity IDs and/or entity names, which is not guaranteed.
### To Reproduce
_No response_
### Actual Behavior
_No response_
### Expected Behavior
_No response_
### Additional context
_No response_
### System information
_No response_
Contributor guide
Research direction
Start by reading org.apache.polaris.core.persistence.cache.EntityCache, focusing on the Caffeine byId cache and the Java byName map. Investigate concurrent accesses involving the same entity IDs or names; done means the cache no longer leaks memory or allows byName to become inconsistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100