Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

sqlite: re-filtering a virtual-table cursor skips generator cleanup

Open
#66,193 0 comments 0 reactions 1 assignee View on GitHub

@trivikr is already working on this.

Since Sep 22, 2026.

Assessment

This issue has not been assessed yet.

Description

sqlite
Version

main

Platform
N/A
Subsystem

sqlite

What steps will reproduce the bug?
import { DatabaseSync } from 'node:sqlite';

const db = new DatabaseSync(':memory:');

let cleaned = 0;
db.createModule('m', {
  columns: [{ name: 'input', type: 'INTEGER', hidden: true }],
  *rows(input) {
    try { yield [input]; } finally { cleaned++; }
  },
});

db.exec('CREATE TABLE t(a); INSERT INTO t VALUES (1), (2)');
db.prepare('SELECT a FROM t WHERE EXISTS(SELECT 1 FROM m(t.a))').all();
console.log(cleaned);  // 1, expected 2
How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

Both rows() calls (for t.a = 1 and t.a = 2) run their finally, so cleaned is 2.

What do you see instead?

cleaned is 1; the first generator is suspended and discarded by the re-filter and its finally never runs.

Additional information

No response

Dominant language
JavaScript
Stars
122k
Forks
37.4k
Avg merge
4d 4h
Merged PRs (30d)
276

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nodejs/node

All issues in nodejs/node

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.