next.js
73bbc694 - [dynamicIO] Avoid triggering memory leak false positive with makeHangingPromise (#71576)

Commit
1 year ago
[dynamicIO] Avoid triggering memory leak false positive with makeHangingPromise (#71576) makeHangingPromise returns a promise that rejects when an AbortSignal aborts. If too many are created however Node warns about a possible memory leak. We shouldn't increase the max count becuase this may prevent detection of legitmate memory leaks in user code. As an alternative we delegate aborts through a weakmap and attach only a single listener. This is trivially slower and more memory but safer semantics. This code only runs during revalidate and build so it does not have a perf impact on production streaming use cases.
Author
Parents
Loading