clojure-lsp / clojure-lsp/clojure-lsp
Global db cache written truncated, fails to load on next startup
- Dominant language
- Clojure
- Stars
- 1.3k
- Forks
- 180
- Avg merge
- 13m
- Merged PRs (30d)
- 4
Description
The global cache at `~/.cache/clojure-lsp/db.transit.json` is sometimes written truncated, so the next startup fails to read it:
```
ERROR [clojure-lsp.db] - [DB] Could not load global cache from DB ...
com.fasterxml.jackson.core.io.JsonEOFException: Unexpected end-of-input: expected close marker for Array
```
It is handled (logged, falls back to cold re-analysis) so it does not fail anything, but it defeats the warm-startup cache. Reproduces locally and in CI, most easily with the fast server shutdowns of the integration tests interrupting the async cache write (#2318 moved the write to a dedicated thread; #2325 enlarged the JDK member global cache, widening the write window).
Fix: write the cache to a temp file and atomically rename it into place.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the global cache writer for ~/.cache/clojure-lsp/db.transit.json and review the integration tests that use fast server shutdowns. Run those tests and verify that interrupted writes leave a valid cache file, allowing the next startup to load the warm cache instead of falling back to cold re-analysis.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100