You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A memory leak occurs when using mergeMap with a concurrency and a synchronous inner observable, apparently due to the nested try-catch in the doInner function.
Somewhat relates to #3609 but isn't the exact same bug.
In this case, you don't actually get the RangeError, and instead receive no feedback at all, it appears the observable just hangs (despite the source and the inner observables all completing).
You can prevent this error by editing the mergeInternals doInnerSub function to not reference the subscriber in the catch.
You can actually leave the try-catch in place, simply commenting out that subscriber reference is enough to prevent the memory leak.
This suggests that the issue is a memory leak due to the way nodejs is holding on to the reference to subscriber in case there is an error (forgive me for not being to articulate that more clearly :p )
jonapgar-groupby
changed the title
Synchronous observables and mergeMap leads to memoryLeak and observable which never completes.
Synchronous observables and mergeMap leads to a memory leak and outer observable never completes.
Sep 11, 2023
jonapgar-groupby
changed the title
Synchronous observables and mergeMap leads to a memory leak and outer observable never completes.
mergeMap with concurrency and synchronous inner observables leads to a memory leak and outer observable never completes.
Sep 11, 2023
Describe the bug
A memory leak occurs when using mergeMap with a concurrency and a synchronous inner observable, apparently due to the nested try-catch in the doInner function.
Somewhat relates to #3609 but isn't the exact same bug.
In this case, you don't actually get the
RangeError
, and instead receive no feedback at all, it appears the observable just hangs (despite the source and the inner observables all completing).You can prevent this error by editing the mergeInternals doInnerSub function to not reference the subscriber in the catch.
https://github.com/ReactiveX/rxjs/blob/7.8.1/src/internal/operators/mergeInternals.ts#L100-L128
You can actually leave the try-catch in place, simply commenting out that subscriber reference is enough to prevent the memory leak.
This suggests that the issue is a memory leak due to the way nodejs is holding on to the reference to subscriber in case there is an error (forgive me for not being to articulate that more clearly :p )
Expected behavior
No memory leak should occur
Reproduction code
You may have to tweak the size of the initial Array to reproduce the error.
The text was updated successfully, but these errors were encountered: