Repository navigation
sqlite: skip query trace while an exception is pending - #67538
Open
gengjiawen wants to merge 1 commit into
Open
gengjiawen wants to merge 1 commit into
gengjiawen wants to merge 1 commit into
Conversation
Collaborator
|
Review requested:
|
gengjiawen
force-pushed
the
sqlite-trace-pending-exception
branch
from
November 17, 2026 09:58
28c28dd to
a2b5f1f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67538 +/- ##
==========================================
+ Coverage 90.67% 90.71% +0.03%
==========================================
Files 800 801 +1
Lines 280489 280707 +218
Branches 54166 54169 +3
==========================================
+ Hits 254336 254632 +296
+ Misses 16277 16254 -23
+ Partials 9876 9821 -55
🚀 New features to boost your workflow:
|
cjihrig
approved these changes
Nov 17, 2026
Database::TraceCallback published sqlite.db.query from SQLite's profile callback without checking for a pending JavaScript exception. SQLite runs that callback from sqlite3_step() when a statement fails and from sqlite3_reset(), so a throwing SQL function or an out-of-range integer conversion called subscriber JS while an exception was already set. Debug builds abort in V8's Invoke, and release builds drop the original error or replace it with an empty ERR_SQLITE_ERROR. Return before publishing when the isolate has a pending exception or JavaScript cannot be entered. Assisted-by: Cursor Grok 4.7 Signed-off-by: gengjiawen <technicalcute@gmail.com>
gengjiawen
force-pushed
the
sqlite-trace-pending-exception
branch
from
November 18, 2026 03:50
a2b5f1f to
821961b
Compare
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Database::TraceCallbackpublished thesqlite.db.querydiagnostics channel from SQLite's profile callback without checking for a pending JavaScript exception. SQLite runs that callback fromsqlite3_step()when a statement fails, and fromsqlite3_reset(), so a throwing SQL function or an out-of-range integer conversion entered subscriber JavaScript while an exception was already set. Debug builds abort in V8Invoke. Release builds drop the original error or replace it with an emptyERR_SQLITE_ERROR.Return before publishing when the isolate has a pending exception or JavaScript cannot be entered.
Test plan
node --expose-gc --test test/parallel/test-sqlite-diagnostic-channel.jsERR_OUT_OF_RANGEfrom an integer that does not fit in a number, with an emptysqlite.db.querysubscriber installed. A later successful query still reaches the subscriber.Made with Cursor