Skip to content

fix(ext/node): guard sqlite deserialize during callbacks#36023

Merged
nathanwhit merged 1 commit into
denoland:mainfrom
nathanwhit:fix/sqlite-deserialize-callback-guard
Jul 14, 2026
Merged

fix(ext/node): guard sqlite deserialize during callbacks#36023
nathanwhit merged 1 commit into
denoland:mainfrom
nathanwhit:fix/sqlite-deserialize-callback-guard

Conversation

@nathanwhit

Copy link
Copy Markdown
Member

This prevents DatabaseSync.deserialize() from replacing database contents while a user-defined SQLite callback is active.

deserialize() finalizes existing statements, so calling it reentrantly could invalidate the statement SQLite is currently executing. The method now uses the existing callback-depth guard and returns ERR_INVALID_STATE, matching DatabaseSync.close() behavior.

Validation:

  • ./tools/format.js
  • cargo build --bin deno
  • focused DatabaseSync.deserialize callback regression
  • full tests/unit_node/sqlite_test.ts suite (78 tests)

@nathanwhit
nathanwhit marked this pull request as ready for review July 13, 2026 23:14
@bartlomieju bartlomieju changed the title fix(node): guard sqlite deserialize during callbacks fix(ext/node): guard sqlite deserialize during callbacks Jul 14, 2026
@nathanwhit
nathanwhit merged commit 744f06b into denoland:main Jul 14, 2026
173 checks passed
bartlomieju pushed a commit that referenced this pull request Jul 15, 2026
This prevents `DatabaseSync.deserialize()` from replacing database
contents while a user-defined SQLite callback is active.

`deserialize()` finalizes existing statements, so calling it reentrantly
could invalidate the statement SQLite is currently executing. The method
now uses the existing callback-depth guard and returns
`ERR_INVALID_STATE`, matching `DatabaseSync.close()` behavior.

Validation:

- `./tools/format.js`
- `cargo build --bin deno`
- focused `DatabaseSync.deserialize` callback regression
- full `tests/unit_node/sqlite_test.ts` suite (78 tests)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants