A consumer report on the GA pair: any minimal add/find/close script hangs forever. Root cause was FOUR ref'd keep-alives brainy never released: 1+2. The global SIGTERM/SIGINT shutdown hooks (registered once at init) were anonymous and never removed — a process.on signal listener holds a ref'd signal handle. They are now named statics, deregistered when the LAST live instance closes (Brainy.instances also stopped leaking closed instances); a later init re-registers them. 3. UnifiedCache.startFairnessMonitor() created an interval it never stored, cleared, or unref'd — unclearable by construction. Now stored + unref'd (same posture as the existing memory-pressure timer): a cache monitor must never keep the host process alive. 4. brainy.close() never called VirtualFileSystem.close(), stranding the VFS background-maintenance interval and the PathResolver maintenance interval. close() now shuts the VFS down. Proof: a bare script (init/add/close, no process.exit) exits 1 ms after close() returns; before the fix it hung until killed. 3 new lifecycle tests pin the hook semantics (once globally, survive while other instances live, removed on last close, re-register after). |
||
|---|---|---|
| .. | ||
| aggregation | ||
| cli | ||
| db | ||
| embeddings | ||
| errors | ||
| graph | ||
| hnsw | ||
| import | ||
| importers | ||
| indexes/columnStore | ||
| integrations | ||
| mcp | ||
| migration | ||
| neural | ||
| patterns | ||
| storage | ||
| streaming | ||
| transaction | ||
| triple | ||
| types | ||
| universal | ||
| utils | ||
| vfs | ||
| brainy.ts | ||
| coreTypes.ts | ||
| index.ts | ||
| internals.ts | ||
| plugin.ts | ||
| setup.ts | ||