René's URL Explorer Experiment


Title: sqlite: GC of an unreferenced session frees memory SQLite is still using · Issue #65460 · nodejs/node · GitHub

Open Graph Title: sqlite: GC of an unreferenced session frees memory SQLite is still using · Issue #65460 · nodejs/node

X Title: sqlite: GC of an unreferenced session frees memory SQLite is still using · Issue #65460 · nodejs/node

Description: Version main (21f0f27) Platform Darwin 25.6.0 Darwin Kernel Version 25.6.0: Fri Jul 31 19:19:08 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T6050 arm64 Subsystem sqlite What steps will reproduce the bug? Let a session become unreacha...

Open Graph Description: Version main (21f0f27) Platform Darwin 25.6.0 Darwin Kernel Version 25.6.0: Fri Jul 31 19:19:08 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T6050 arm64 Subsystem sqlite What steps will reproduc...

X Description: Version main (21f0f27) Platform Darwin 25.6.0 Darwin Kernel Version 25.6.0: Fri Jul 31 19:19:08 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T6050 arm64 Subsystem sqlite What steps will reproduc...

Opengraph URL: https://github.com/nodejs/node/issues/65460

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlite: GC of an unreferenced session frees memory SQLite is still using","articleBody":"### Version\n\n`main` (21f0f2786f0)\n\n### Platform\n\n```text\nDarwin 25.6.0 Darwin Kernel Version 25.6.0: Fri Jul 31 19:19:08 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T6050 arm64\n```\n\n### Subsystem\n\nsqlite\n\n### What steps will reproduce the bug?\n\nLet a session become unreachable from JavaScript, then let GC run while SQLite is inside its pre-update hook. Run with `--expose-gc`:\n\n```js\nimport { DatabaseSync, constants } from 'node:sqlite';\n\nconst db = new DatabaseSync(':memory:');\ndb.exec('CREATE TABLE t(a PRIMARY KEY)');\ndb.createSession(); // return value dropped: no JS reference kept\n\nlet once = true;\ndb.setAuthorizer((action, p1) => {\n  if (action === constants.SQLITE_PRAGMA && p1 === 'table_xinfo' && once) {\n    once = false;\n    globalThis.gc();\n    globalThis.gc();\n  }\n  return constants.SQLITE_OK;\n});\n\ndb.exec('INSERT INTO t VALUES (1)');\nconsole.log('survived');\n```\n\nA `'sqlite.db.query'` diagnostics-channel subscriber calling `gc()` in place of the authorizer crashes the same way.\n\n### How often does it reproduce? Is there a required condition?\n\nI get exit 139 on every run.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe write should complete and the session should still record the change. A session that JavaScript can no longer reach is still registered on the connection and still accumulating changes, so collecting it is observable in two ways beyond the crash: the changeset silently stops recording, and `sqlite3session_delete()` runs at an arbitrary point.\n\n### What do you see instead?\n\n`EXC_BAD_ACCESS` in `sqlite3StrICmp`, from the `sqlite3_strnicmp(zDb, pSession->zDb, nDb + 1)` comparison in `xPreUpdate` (`deps/sqlite/sqlite3.c:235727`) reading a freed `sqlite3_session`.\n\n### Additional information\n\n`Session` calls `MakeWeak()` (`src/node_sqlite.cc:4271`) and `DatabaseSync::sessions_` holds raw `Session*` (`src/node_sqlite.h:340`), so nothing keeps a session alive once JS drops it. SQLite's pre-update hook walks the connection's session list and runs `PRAGMA table_xinfo` from inside that walk, which reaches JavaScript and gives GC a chance to run while the walk still holds pointers into the session being visited.\n\nThis is the same window as #65428, but a different trigger.\n\nThe obvious fix of making `sessions_` hold `BaseObjectPtr\u003cSession>` does not work on its own: `Session::database_` is already a `BaseObjectPtr\u003cDatabaseSync>`, so that creates a cycle that leaks both objects for the life of the process. Options that seem workable: hold strong refs to the attached sessions only for the duration of SQLite calls that can fire the pre-update hook, or keep sessions strongly held by the database and make the back-reference weak.\n","author":{"url":"https://github.com/TrevorBurnham","@type":"Person","name":"TrevorBurnham"},"datePublished":"2026-08-21T17:01:29Z","url":"https://github.com/nodejs/node/issues/65460"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:79ba557a-1557-a579-7e5d-6274d58606f4
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE5BA:C8434:3F03F8:51AA0C:6AED2104
html-safe-nonce3ca2ed5a2a92a9729e9178c4d2686e956be88d51a6016b52685bf345d5b257d0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNUJBOkM4NDM0OjNGMDNGODo1MUFBMEM6NkFFRDIxMDQiLCJ2aXNpdG9yX2lkIjoiOTE0NjY3MjAxMDE2NTU1OTU1NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0bf40dd18cad298b1e000f042dc8e722b1c5798718fb12fc5b934c13752c7176
hovercard-subject-tagissue:5216381799
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/65460/issue_layout
twitter:imagehttps://opengraph.githubassets.com/af2c3e5f7c0a16c5b8644d0ae9f547837caf505fecd8eaaec2bf8de8ff3b8a2d/nodejs/node/issues/65460
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/af2c3e5f7c0a16c5b8644d0ae9f547837caf505fecd8eaaec2bf8de8ff3b8a2d/nodejs/node/issues/65460
og:image:altVersion main (21f0f27) Platform Darwin 25.6.0 Darwin Kernel Version 25.6.0: Fri Jul 31 19:19:08 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T6050 arm64 Subsystem sqlite What steps will reproduc...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameTrevorBurnham
hostnamegithub.com
expected-hostnamegithub.com
Nonee3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release707a24b346ac8a82878b9c084efaa38a997660cb
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/65460#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65460
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F65460
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/65460
Reloadhttps://github.com/nodejs/node/issues/65460
Reloadhttps://github.com/nodejs/node/issues/65460
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65460
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65460
#65465https://github.com/nodejs/node/pull/65465
sqlite: GC of an unreferenced session frees memory SQLite is still usinghttps://github.com/nodejs/node/issues/65460#top
#65465https://github.com/nodejs/node/pull/65465
https://github.com/TrevorBurnham
TrevorBurnhamhttps://github.com/TrevorBurnham
on Aug 21, 2026https://github.com/nodejs/node/issues/65460#issue-5216381799
21f0f27https://github.com/nodejs/node/commit/21f0f2786f02f930acd56c0665dc65a8bb1693f5
#65428https://github.com/nodejs/node/issues/65428
nodejs-github-bothttps://github.com/nodejs-github-bot
on Aug 28, 2026https://github.com/nodejs/node/issues/65460#event-30188581792
sqlite: keep sessions alive across SQLite callbackshttps://github.com/nodejs/node/commit/76aeacf6877dff12e3f0990c40b8d86782c81049
76aeacfhttps://github.com/nodejs/node/commit/76aeacf6877dff12e3f0990c40b8d86782c81049
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#65465https://github.com/nodejs/node/pull/65465
on Aug 28, 2026https://github.com/nodejs/node/issues/65460#event-30188581859
aduh95https://github.com/aduh95
on Aug 29, 2026https://github.com/nodejs/node/issues/65460#event-30208027908
sqlite: keep sessions alive across SQLite callbackshttps://github.com/nodejs/node/commit/9180666ea5388b2f26ea42338fad8d134211fb33
9180666https://github.com/nodejs/node/commit/9180666ea5388b2f26ea42338fad8d134211fb33
sqlite: keep sessions alive across SQLite callbackshttps://github.com/nodejs/node/commit/035a9b8bfd4c62e6f9590b2051d6c45b35d89c90
035a9b8https://github.com/nodejs/node/commit/035a9b8bfd4c62e6f9590b2051d6c45b35d89c90
aduh95https://github.com/aduh95
on Sep 15, 2026https://github.com/nodejs/node/issues/65460#event-31161510948
sqlite: keep sessions alive across SQLite callbackshttps://github.com/nodejs/node/commit/5f95032859b4fcb44a975176d6be471d57f86ce5
5f95032https://github.com/nodejs/node/commit/5f95032859b4fcb44a975176d6be471d57f86ce5
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/65460
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/65460
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.