fix(#252): close leftover ioredis handles so e2e jest exits cleanly (no forceExit) #254
Open
agent_coder
wants to merge 1 commits from
fix/252-e2e-open-handles into develop
pull from: fix/252-e2e-open-handles
merge into: vvzvlad:develop
vvzvlad:main
vvzvlad:test/244-part-b
vvzvlad:fix/255-ws-redis-adapter-leak
vvzvlad:feat/251-intentional-clear
vvzvlad:feat/184-autonomous-agent-runs
vvzvlad:feat/221-image-captions
vvzvlad:feat/git-sync
vvzvlad:refactor/193-tool-spec-registry
vvzvlad:fix/244-dataloss-bugs
vvzvlad:fix/embeddings-reindex-progress
vvzvlad:develop
vvzvlad:feature/offline-sync
vvzvlad:feat/229-catalog-yaml
vvzvlad:feat/243-blob-sandbox
vvzvlad:feat/228-inline-footnotes
vvzvlad:fix/qa-ui-bugs-216-218
vvzvlad:feature/agent-roles-catalog
vvzvlad:fix/share-alias-rename
vvzvlad:fix/ai-chat-empty-render
vvzvlad:feat/191-chat-doc-binding
vvzvlad:feat/201-temporary-notes
vvzvlad:feat/198-interrupt-agent
vvzvlad:feat/ai-chat-full-history
vvzvlad:feat/199-ai-generate-title
vvzvlad:feat/205-share-aliases
vvzvlad:batch/issues-189-187-170
vvzvlad:feat/170-mcp-test-button
vvzvlad:feat/189-context-badge
vvzvlad:feat/198-interrupt-agent-send-now
vvzvlad:fix/issues-190-159
vvzvlad:fix/ai-chat-new-chat-during-stream
vvzvlad:fix/ai-chat-stream-perf
vvzvlad:batch/issues-2026-06-25
vvzvlad:feat/ai-chat-persistent-history
vvzvlad:fix/ai-chat-copy-chat-wysiwyg
vvzvlad:fix/ai-stream-reset-resilience
vvzvlad:fix/ai-stream-undici-timeout
vvzvlad:fix/footnote-review-1227-followup
vvzvlad:fix/ai-chat-token-counter-realtime
vvzvlad:docs/manual-qa-test-plan
1 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8274720281 |
fix(server): close leaked redis sockets so e2e jest exits (#252)
The full-AppModule e2e (apps/server/test/app.e2e-spec.ts) passed but jest never exited, burning CI to its timeout. Diagnosis (process._getActiveHandles after app.close()) showed exactly two ioredis sockets to :6379 still open after shutdown; everything else (BullMQ queues/workers, @nestjs/schedule intervals, nestjs-ioredis, nestjs-kysely pg pool, @nestjs/cache-manager Keyv store, hocuspocus pub/sub) already closes on app.close(). The two leaks were owned-but-never-closed clients: 1. ThrottleModule passed a pre-built `new Redis(...)` instance to ThrottlerStorageRedisService. With an instance, the lib sets disconnectRequired=false, so its onModuleDestroy never disconnects. Pass ioredis options instead so the service owns + disconnects the client. 2. CollaborationGateway created a source `new RedisClient(...)` that RedisSyncExtension only duplicates into pub/sub; the extension's onDestroy disconnects those duplicates but not the source. Keep a reference and disconnect it after the hocuspocus onDestroy hook in destroy(). Both are real lifecycle fixes (production shutdown is now clean too), so no --forceExit is needed. Verified against real Postgres+Redis: - test:e2e (no forceExit, --runInBand) exits 0 in ~18s (was: hung forever) - --detectOpenHandles exits 0 with no open-handle report - active handles after app.close(): none CI timeout-minutes safety nets left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |