Skip to content

sqlite: throw on disposal of an in-use session - #65449

Open
araujogui wants to merge 1 commit into
nodejs:mainfrom
araujogui:sqlite-dispose-in-use-guard
Open

sqlite: throw on disposal of an in-use session#65449
araujogui wants to merge 1 commit into
nodejs:mainfrom
araujogui:sqlite-dispose-in-use-guard

Conversation

@araujogui

Copy link
Copy Markdown
Member

session[Symbol.dispose]() wrapped Session::Close() in a v8::TryCatch and discarded whatever it threw, so the in-use guard added by #65349 rejected the close but the exception never reached JavaScript. Disposing a session while it is generating a changeset or patchset appeared to succeed and left the session open, and [Symbol.dispose]() disagreed with close() about a state both should reject.

Session::Dispose() no longer delegates through Close(). It follows the same shape as StatementSync::Dispose(): return early when the session is already closed, then apply the in-use guard and let ERR_INVALID_STATE propagate. Dropping the "database is not open" check is intentional — DatabaseSync::Close() runs DeleteSessions() first, so a session on a closed database is already closed and disposal stays a no-op there.

Fixes: #65447
Refs: #65349

Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
Copilot AI lite review requested due to automatic review settings August 21, 2026 01:54
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.12%. Comparing base (9ea6182) to head (a154004).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/node_sqlite.cc 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65449      +/-   ##
==========================================
+ Coverage   90.11%   90.12%   +0.01%     
==========================================
  Files         752      752              
  Lines      252317   252318       +1     
  Branches    47432    47435       +3     
==========================================
+ Hits       227376   227409      +33     
+ Misses      16259    16216      -43     
- Partials     8682     8693      +11     
Files with missing lines Coverage Δ
src/node_sqlite.cc 81.89% <85.71%> (+0.07%) ⬆️

... and 32 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: session[Symbol.dispose]() silently ignores the in-use guard

4 participants