Repository navigation
fix: require better-sqlite3 ^12.8.0 so Node 24 does not abort on statement GC - #29
Open
proffesor-for-testing wants to merge 1 commit into
Open
proffesor-for-testing wants to merge 1 commit into
proffesor-for-testing wants to merge 1 commit into
Conversation
…ement GC better-sqlite3 11.x publishes no Node 24 (ABI 137) prebuild, so `^11.8.1` was compiled locally against the running Node's headers. Node 24.19+ headers carry a partial node::ObjectWrap cleanup-hook backport (nodejs/node#65446); the locally built addon then aborts with `Assertion failed: (env) != nullptr` when V8 collects a Statement in an allocation-driven GC. ruflo hits this mid memory search (exit 134, "Connection closed" over MCP). better-sqlite3 12.x ships a Node 24 prebuild built before the regression. Its API is unchanged for the calls agentdb makes; it requires Node >= 20. The new test prepares and drops 200k statements in a child process and fails on a source-built 11.x under Node 24.21 (abort), passing on 12.x.
proffesor-for-testing
marked this pull request as ready for review
October 9, 2026 19:30
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.
Problem
On Node 24.19 and later, processes using agentdb's native SQLite path abort intermittently:
In ruflo this kills
ruflo memory search(exit 134) and the ruflo MCP server ("Connection closed" onmemory_search_unified,memory_storeandagentdb_pattern-search). See ruvnet/ruflo#3955.Root cause
node::ObjectWrap" without the cleanup-hook registry that makes it safe (24.19.0:node::ObjectWrapcleanup hooks backported without the cleanup hook registry, aborts on every 24.x runtime nodejs/node#65446; the backport PR [v24.x backport] src: keep global list of addon-provided cleanup hooks nodejs/node#65943 was closed without merging).node_object_wrap.his header-only, so any addon compiled against 24.19+ headers callsRemoveEnvironmentCleanupHook()from~ObjectWrap(). When V8 collects a wrapped object in an allocation-driven GC, there is no current Environment and the process aborts. better-sqlite3 has the same report: Intermittent ObjectWrap cleanup abort during Statement GC on Node 24 WiseLibs/better-sqlite3#1515.^11is exposed. agentdb declaresbetter-sqlite3: ^11.8.1, which resolves to 11.10.0. The 11.10.0 release has nonode-v137(Node 24) prebuild; its Linux prebuilds stop atnode-v131. So on Node 24,prebuild-installfalls back tonode-gyp rebuildagainst the local headers:^12is safe. better-sqlite3 12.11.1 ships anode-v137prebuild built on 2026-06-15, before the regression. It does not importRemoveEnvironmentCleanupHook.overridescannot reach this: npm ignoresoverridesin a dependency's package.json. Evennpm i -g rufloinstalls the nested 11.10.0 underagentdb/. So the range has to change here.Fix
optionalDependencies.better-sqlite3:^11.8.1→^12.8.0.package-lock.jsonnow resolves 12.11.1, the last 12.x.new Database,pragma,prepare/run/get/all,exec,transaction,close.tests/better-sqlite3-statement-gc.test.ts:>= 12.8.0.node::ObjectWrapcleanup hooks backported without the cleanup hook registry, aborts on every 24.x runtime nodejs/node#65446 trigger. The test asserts the process survives.[Unreleased].Verification (linux-x64)
Minimal probe, 200k prepared statements dropped under allocation pressure, Node 24.21.0:
New test, Node 24.21.0:
Existing suites. I ran the 29 test files that touch better-sqlite3,
db-fallbackornew AgentDB. The fullvitest --run(it includessimulation/) did not finish within 30 minutes here.env != nullptr)How to read the table:
Unknown controller: self-attention,memoryController.store is not a function,Embedding outputDimension must be a positive integer, andCannot find modulefor files that need a build.vector-search > should benefit from embedding cacheis a timing comparison. It also fails 2/3 runs on main with Node 22 and 11.x.cli-mcp-integration > should work with SkillLibrary on SQLitepasses 3/3 when its file runs alone on 12.x. It only fails when it shares the run with other files (UNIQUE constraint failed: skills.name).End-to-end with ruflo. I ran
npm packon this branch afternpm run build, thennpm install ruflo@3.56.2 ./agentdb-3.0.0-alpha.20.tgzin a scratch project. This is unmodified ruflo, without ruvnet/ruflo#3955.Notes / not covered
engines.node: 20.x || 22.x || 23.x || 24.x || 25.x || 26.x. agentdb still says>=18. better-sqlite3 12.10.0 also dropped the Node 20 prebuilds, so 12.11.1 ships prebuilds only for node-v127/137/141/147 (11.10.0 had v108/115/127/131). On Node 18 and Node 20 (both EOL), npm builds 12.x from source; it is optional, so agentdb falls back to sql.js if that fails (verified: with better-sqlite3 absent,getDatabaseImplementation()uses sql.js). Raising agentdb'senginesis left to the maintainers.node-v137-linuxmusl-x64ships in 12.8.0–12.11.1),--build-from-sourceandnpm rebuild. The real fix is 24.19.0:node::ObjectWrapcleanup hooks backported without the cleanup hook registry, aborts on every 24.x runtime nodejs/node#65446.^12.8.0keeps resolving to the pre-regression prebuild. Moving to 13.x needs this checked again.^11. This PR fixes it for every consumer.🤖 Generated by Ruflo & AQE