tursodatabase / tursodatabase/libsql-client-ts
@libsql/client embedded replica leaks memory
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 576
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Hi! There is a major memory leak when using embedded replicas (calling client.sync and then making any query on the client).
The reproduction repo is here with instructions.
Here is a screenshot of the Fly container memory (using sync)
At the 13:24:00 mark, the load test is executed. Memory continues to grow and flat lines after the test ends (most of the memory is never released).
NOTE: and 2nd container was created (13:27:00) b/c the 1st almost ran out of memory
Here is a screenshot of the same app but w/o using embedded replicas:
At the 13:53:00 mark, the load test is executed. Memory never explodes and stays leveled. At the end of the test, the memory is freed (there's a slight difference from the start/end, but that's just normal node GC behavior... sometimes the ending memory is less than the starting memory)
Contributor guide
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 the linked turso_leak reproduction and follow its instructions to run client.sync followed by queries against the embedded replica. Compare memory during and after the load test with the non-embedded setup; done means identifying and resolving the leak so memory no longer grows persistently after the test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite, typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100