next.js
c5b960e2 - Fix request-context retention in the default use cache handler (#97941)

Commit
1 day ago
Fix request-context retention in the default use cache handler (#97941) Fixes #97934. The default use cache handler uses live ReadableStream objects. Those streams retain references to the request’s async context and closed HTTP response, causing memory to grow with cached entries and potentially produce OOMs. The fix converts each stream into a plain Buffer before caching it. Every cache hit then gets a fresh temporary stream created from those bytes. The content remains cached, but completed requests can now be garbage-collected. --- Basically - the LRU cache stores live ReadableStream objects, which keep completed request contexts and closed responses in memory until that cache is evicted.
Author
Parents
Loading