Closed crunchie84 closed 7 years ago
I added a test to verify the observables returned by the durationSelector where indeed not closed in 4bd3ea2aa. A simple fix is something like 1a03cc29.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
RxJS version: 5.4.0 Code to reproduce:
Live version can be found at t his jsbin https://jsbin.com/vilacos/16/edit?js,console
Expected behavior:
When the
durationSelector
emits a value the group is completed. This should make theGroupBySubscriber
also unsubscribe from thedurationSelector
so it can be garbage collected.We would expect the
finally()
to be invoked directly after the durationSelector has emitted a value because it completes the groupBy grouping thus creating the following console logs:but instead the unsubscribe from the durationSelectors are only emitted when the groupBy completes due to the
take(3)
in the outer stream.Appending
.take(1)
to the durationSelector stream manually fixes this behaviour (note; this was implemented as such in rxjs4 groupbyuntil.)Actual behavior:
The
durationSelector
is not unsubscribed when the group has been completed. Only when theGroupBy
is completed itself it releases all its captured durationSelectors. This results in hoarding of memory until OOM (our case) or parent stream is completed.