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
When the durationSelector emits a value the group is completed. This should make the GroupBySubscriber also unsubscribe from the durationSelector 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:
grouping: 0
grouping: 1
[durationSelector] emitting value for group 0: 11
[durationSelector] unsubcribed for group 0
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 the GroupBy is completed itself it releases all its captured durationSelectors. This results in hoarding of memory until OOM (our case) or parent stream is completed.
The text was updated successfully, but these errors were encountered:
crunchie84
changed the title
GroupBy subscription leak - durationSelector
GroupBy subscriptions not disposed in due time - durationSelector
Jun 13, 2017
…e group
The Groups are disposed by the GroupDurationSelector, however the
GroupDurationSubscriber can be subscribed to a different observable
than the group itself. To prevent any unwanted subscriptions to
accumulate over time we need to explicitly unsubscribe after the
first event in GroupDurationSubscriber closes the group.
FixesReactiveX#2660
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.The text was updated successfully, but these errors were encountered: