fix(memory): add .unref() to housekeeping timers to prevent process hang#1269
Open
webdevpraveen wants to merge 1 commit intoruvnet:mainfrom
Open
fix(memory): add .unref() to housekeeping timers to prevent process hang#1269webdevpraveen wants to merge 1 commit intoruvnet:mainfrom
webdevpraveen wants to merge 1 commit intoruvnet:mainfrom
Conversation
CacheManager.startCleanupTimer() and SqlJsBackend auto-persist timer call setInterval() without .unref(), keeping the Node.js event loop alive indefinitely. Any CLI command that touches memory (memory store, memory search, etc.) cannot exit cleanly. Other timers in the same package (agentdb-backend.js:142, auto-memory-bridge.js:534) correctly call .unref(). This commit brings cache-manager.ts and sqljs-backend.ts in line with that pattern. Fixes ruvnet#1256
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.
Adds
.unref()to twosetIntervaltimers that prevent the Node.js process from exiting cleanly.Problem
CacheManager.startCleanupTimer()and SqlJsBackend 's auto-persist timer both callsetInterval()without.unref(), keeping the event loop alive indefinitely. This means any CLI command that touches memory (memory store,memory search, etc.) hangs after completing its work and never exits - users have toCtrl+Cto kill it.Fix
Added
.unref()after eachsetIntervalcall, guarded by an existence check for environments where.unref()may not be available:Why this is safe
shutdown()methods already handle final cleanup/persist explicitly.agentdb-backend.js:142,auto-memory-bridge.js:534) already call.unref()correctly - this just brings the remaining two in line with that pattern.Fixes Issue #1256