Skip to content

sqlite: validate connection after reading options - #65591

Open
lazerg wants to merge 2 commits into
nodejs:mainfrom
lazerg:fix/issue-65586-sqlite-options-getters
Open

sqlite: validate connection after reading options#65591
lazerg wants to merge 2 commits into
nodejs:mainfrom
lazerg:fix/issue-65586-sqlite-options-getters

Conversation

@lazerg

@lazerg lazerg commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

function(), aggregate(), deserialize(), prepare(), applyChangeset(), backup() and the tag store check that the connection is open before reading their options bag. A getter on that object can call db.close(), leaving the rest of the call running against a null connection. Five of them segfault; prepare() and the tag store report ERR_SQLITE_ERROR: out of memory instead.

The open check now runs again once the options have been read, right before the connection reaches SQLite. Re-checking keeps the current error precedence, which parsing the options up front the way createSession() does would change.

Fixes: #65586

Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem. labels Aug 27, 2026
Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.28571% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.08%. Comparing base (9baabd4) to head (3e733a7).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/node_sqlite.cc 64.28% 0 Missing and 5 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #65591   +/-   ##
=======================================
  Coverage   90.07%   90.08%           
=======================================
  Files         751      751           
  Lines      254875   254895   +20     
  Branches    48108    48137   +29     
=======================================
+ Hits       229579   229617   +38     
+ Misses      16466    16459    -7     
+ Partials     8830     8819   -11     
Files with missing lines Coverage Δ
src/node_sqlite.cc 82.05% <64.28%> (+0.01%) ⬆️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlite: option getters run user JS mid-call, then stale state is used

2 participants