FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

sqlite: fix segfault SQLTagStore when db handle is garbage collected by louwers · Pull Request #60462 · nodejs/node · GitHub

/ node Public

sqlite: fix segfault SQLTagStore when db handle is garbage collected - #60462

Merged
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
louwers:fix-60448
Jan 31, 2026
Merged

sqlite: fix segfault SQLTagStore when db handle is garbage collected#60462
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
louwers:fix-60448

Conversation

louwers commented Oct 28, 2025

Copy link
Copy Markdown
Contributor

Fixes #60448 by changing from a BaseObjectWeakPtr to a BaseObjectPtr.

A SQLTagStore should keep the database alive.

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite

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 Oct 28, 2025

cjihrig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Left a couple comments, but LGTM.

Comment thread src/node_sqlite.h Outdated

codecov Bot commented Oct 28, 2025
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.53%. Comparing base (fc0952f) to head (20a0eed).
⚠️ Report is 206 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60462      +/-   ##
==========================================
- Coverage   88.54%   88.53%   -0.02%     
==========================================
  Files         704      704              
  Lines      208753   208760       +7     
  Branches    40279    40280       +1     
==========================================
- Hits       184844   184821      -23     
- Misses      15919    15930      +11     
- Partials     7990     8009      +19     
Files with missing lines Coverage Δ
src/node_sqlite.cc 80.26% <100.00%> (+0.09%) ⬆️
src/node_sqlite.h 80.39% <ø> (ø)

... and 31 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.

This comment was marked as off-topic.

This comment was marked as off-topic.

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 29, 2025
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 29, 2025

louwers commented Dec 29, 2025

Copy link
Copy Markdown
Contributor Author

@mcollina I need to fix the issue brought up by @addaleax.

I need to figure out how to add an internal field to SQLTagStore.

louwers marked this pull request as draft December 29, 2025 10:53
louwers marked this pull request as ready for review January 3, 2026 22:25

louwers commented Jan 3, 2026

Copy link
Copy Markdown
Contributor Author

I implemented @addaleax' suggestion by adding an internal field to SQLTagStore. Admittedly Claude gave a helping hand, I didn't do that before.

The tests confirms that the segfault no longer occurs and the memory leak of my previous solution also does not appear.

Comment thread src/node_sqlite.cc Outdated

louwers commented Jan 4, 2026

Copy link
Copy Markdown
Contributor Author

Could someone trigger CI? I am not a collaborator.

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 13, 2026
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 13, 2026

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

louwers commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

Tests seem to be stuck.

mcollina added commit-queue Add this label to land a pull request using GitHub Actions. and removed needs-ci PRs that need a full CI run. labels Jan 28, 2026
nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 28, 2026

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/60462
✔  Done loading data for nodejs/node/pull/60462
----------------------------------- PR info ------------------------------------
Title      sqlite: fix segfault SQLTagStore when db handle is garbage collected (#60462)
Author     Bart Louwers <bart.louwers@gmail.com> (@louwers)
Branch     louwers:fix-60448 -> nodejs:main
Labels     c++, sqlite
Commits    3
 - sqlite: change approach to fix segfault SQLTagStore
 - sqlite: add eslint ignore for no-void
 - sqlite: remove redundant parameter
Committers 1
 - Bart Louwers <bart@emeel.net>
PR-URL: https://github.com/nodejs/node/pull/60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 28 Oct 2025 15:01:30 GMT
   ✔  Approvals: 5
   ✔  - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/60462#pullrequestreview-3389333091
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/60462#pullrequestreview-3657775960
   ✔  - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/60462#pullrequestreview-3624591879
   ✔  - Gürgün Dayıoğlu (@gurgunday): https://github.com/nodejs/node/pull/60462#pullrequestreview-3684621830
   ✔  - Zeyu "Alex" Yang (@himself65): https://github.com/nodejs/node/pull/60462#pullrequestreview-3684626705
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-01-20T20:59:49Z: https://ci.nodejs.org/job/node-test-pull-request/70927/
- Querying data for job/node-test-pull-request/70927/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 60462
From https://github.com/nodejs/node
 * branch                  refs/pull/60462/merge -> FETCH_HEAD
✔  Fetched commits as 74c365846533..20a0eed2c829
--------------------------------------------------------------------------------
Auto-merging src/node_sqlite.cc
Auto-merging src/node_sqlite.h
Auto-merging test/parallel/test-sqlite-template-tag.js
[main c05ac0c37b] sqlite: change approach to fix segfault SQLTagStore
 Author: Bart Louwers <bart@emeel.net>
 Date: Sat Jan 3 23:19:30 2026 +0100
 3 files changed, 51 insertions(+), 7 deletions(-)
Auto-merging test/parallel/test-sqlite-template-tag.js
[main 7d9121e572] sqlite: add eslint ignore for no-void
 Author: Bart Louwers <bart@emeel.net>
 Date: Sat Jan 3 23:31:19 2026 +0100
 1 file changed, 2 insertions(+), 1 deletion(-)
Auto-merging src/node_sqlite.cc
Auto-merging src/node_sqlite.h
[main 2a32ac0336] sqlite: remove redundant parameter
 Author: Bart Louwers <bart@emeel.net>
 Date: Sun Jan 4 00:25:53 2026 +0100
 2 files changed, 5 insertions(+), 11 deletions(-)
   ✔  Patches applied
There are 3 commits in the PR. Attempting autorebase.
(node:2364) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/6)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
sqlite: change approach to fix segfault SQLTagStore

PR-URL: #60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>

[detached HEAD 44bed5cdfc] sqlite: change approach to fix segfault SQLTagStore
Author: Bart Louwers <bart@emeel.net>
Date: Sat Jan 3 23:19:30 2026 +0100
3 files changed, 51 insertions(+), 7 deletions(-)
Rebasing (3/6)
Rebasing (4/6)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
sqlite: add eslint ignore for no-void

PR-URL: #60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>

[detached HEAD 9b9492e455] sqlite: add eslint ignore for no-void
Author: Bart Louwers <bart@emeel.net>
Date: Sat Jan 3 23:31:19 2026 +0100
1 file changed, 2 insertions(+), 1 deletion(-)
Rebasing (5/6)
Rebasing (6/6)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
sqlite: remove redundant parameter

PR-URL: #60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>

[detached HEAD 5c9047f816] sqlite: remove redundant parameter
Author: Bart Louwers <bart@emeel.net>
Date: Sun Jan 4 00:25:53 2026 +0100
2 files changed, 5 insertions(+), 11 deletions(-)
Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/21426684111

gurgunday added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jan 28, 2026
mcollina added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jan 31, 2026
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 31, 2026
nodejs-github-bot merged commit f6464c5 into nodejs:main Jan 31, 2026
86 of 89 checks passed

Copy link
Copy Markdown
Collaborator

Landed in f6464c5

aduh95 pushed a commit that referenced this pull request Feb 2, 2026
PR-URL: #60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
aduh95 pushed a commit that referenced this pull request Feb 2, 2026
PR-URL: #60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
aduh95 pushed a commit that referenced this pull request Feb 10, 2026
PR-URL: #60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
aduh95 pushed a commit that referenced this pull request Feb 14, 2026
PR-URL: #60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
aduh95 pushed a commit that referenced this pull request Feb 22, 2026
PR-URL: #60462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
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

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. sqlite Issues and PRs related to the SQLite subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sqlite: segmentation fault using SQLTagStore if there's no reference to the underlying database

9 participants


Back | FazBrowse Home | New Git URL