sqlite: fix segfault SQLTagStore when db handle is garbage collected#60462
sqlite: fix segfault SQLTagStore when db handle is garbage collected#60462nodejs-github-bot merged 3 commits intonodejs:mainfrom
Conversation
|
Review requested:
|
cjihrig
left a comment
There was a problem hiding this comment.
Left a couple comments, but LGTM.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
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. |
|
Could someone trigger CI? I am not a collaborator. |
|
Tests seem to be stuck. |
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 SQLTagStorehttps://github.com/nodejs/node/actions/runs/21426684111 |
|
Landed in f6464c5 |
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>
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>
Fixes #60448 by changing from a
BaseObjectWeakPtrto aBaseObjectPtr.A SQLTagStore should keep the database alive.