vercel / vercel/resumable-stream

Memory leak: Redis clients are not closed

Open
#30 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
574
Forks
44
Avg merge
3m
Merged PRs (30d)
1

Description

My understanding after reading the code of this library is that the Redis clients that are created by the default configuration are never closed.

To mitigate the memory leak, one can use the library like this to take control over the client lifecycle:

const redisUrl = '...'

const publisherRedisClient = createClient({ url: redisUrl })
await publisherRedisClient.connect()

const subscriberRedisClient = createClient({ url: redisUrl })
await subscriberRedisClient.connect()

const resumableStreamContextOpts = {
  waitUntil: null,
  publisher: publisherRedisClient,
  subscriber: subscriberRedisClient,
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing how the default configuration creates its Redis publisher and subscriber clients, then compare that with the caller-managed lifecycle shown in the issue. Done means the default-created clients have a defined cleanup path and the memory leak scenario is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
redis, typescript
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.