fix: Memoize AsyncLocalStorage instance#8831
Conversation
size-limit report 📦
|
Lms24
left a comment
There was a problem hiding this comment.
Hmm I'm not sure but wouldn't this mean we potentially reuse the same asyncLocalStorage instance across multiple requests which we actually want to isolate? Don't have a ton of context around ALS so not sure if this concern makes sense
Well yes, but that is theoretically not an issue. What matters is that I am trying to come up with a case where we might run into problems here, but I am struggling. I guess the baseline where this potentially messes up always involves calling |
Lms24
left a comment
There was a problem hiding this comment.
Thanks for explaining, this makes sense to me now! I'd say we give it a try and if the issue author is comfortable with trying this out locally first, it'd be even better.
|
TIL the leak is likely because |
|
Wouldn't this stop us or customers from overriding the async strategy after it's been set by |
No sorry, I misundersttod the changes! |
Attempts to fix the memory leak reported in #8829 by memoizing the
AsyncLocalStorageinstance we create when setting the async context strategy.Note for reviewers: Can you think of any problems this may cause?