StatementIterator leaks if not run to completion
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
A statement provided by StatementIterator can be leaked until the Database is closed if the iterator is not run to completion. A statement is not freed until next is called for the following iteration, which might not happen if, for example, a for...of loop is exited via break, return, or thrown exception.
Careful coding can work around this issue, but that code will also be uglier and harder to read. A better fix would be to implement the optional return method on the iterator to reclaim its resources, as that will be automatically called on early loop termination.
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 in src/api.js at the StatementIterator next implementation referenced by the issue, then review the ECMAScript optional iterator return method. Confirm how early for...of termination behaves when using break, return, or an exception. Done means the statement is reclaimed on early termination instead of remaining allocated until the Database closes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100