objectionary / objectionary/lints
`LtDfSticky` cache grows infinitely due to unbounded limit and faulty equal check in key
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 14
- Forks
- 39
- Avg merge
- 22h 54m
- Merged PRs (30d)
- 90
Description
Problem
The LtDfSticky defect cache (backed by cactoos StickyBiFunc) never evicts entries, and its key has broken equality semantics, so in a long-lived JVM the cache grows without bounds while rarely hitting.
Root cause
-
StickyBiFunc(cactoos 0.61.1) stores results in aLinkedHashMapwith capacityInteger.MAX_VALUE— no eviction. BecauseSource.MONOis a static singleton (src/main/java/org/eolang/lints/Source.java:27-31), every XMIR document ever analyzed by the JVM stays in memory forever → OOM under batch/daemon workloads. -
The cache key is the
XMLobject itself.XMLDocument.equalscompares bytoString()(content) buthashCodeis node-identity based (Node.hashCode()in jcabi-xml) — so two documents with identical content produce different hash codes, and the cache almost never hits for differentSourceinstances, while still growing per new document.
Expected behavior
- Bound the cache (capacity or time-based eviction), or scope it per
Sourceinstance instead of a static singleton. - Make the key content-based (hash by
toString()), so identical documents share cache entries.
Related
src/main/java/org/eolang/lints/LtDfSticky.java:38-43— the wrapper.P1(#1389) — the relatedunlint-non-existing-defectperformance issue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/main/java/org/eolang/lints/LtDfSticky.java:38-43 and Source.java:27-31, then inspect how cactoos StickyBiFunc stores entries and how XML equality and hashing behave. The work is done when the cache has bounded lifetime or scope and identical document content reuses entries without unbounded growth.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- performance, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100