Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(catch): fix catch to dispose old subscriptions #769

Closed
wants to merge 1 commit into from

Conversation

staltz
Copy link
Member

@staltz staltz commented Nov 24, 2015

DEPENDS ON PR #764 MERGED FIRST.

Fix catch operator to not have anymore a shared underlying Subscription, and instead reset the
subscription for each new observable replacing the caught error. This fixes a potential memory leak
if catch is used as an infinite retry, because subscriptions would be retained since the beginning,
and would increasing each time a catch is performed.

Resolves issue #763.

this.destination.complete();
}

_unsubscribe() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function being called?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to test coverage, yes it is. _unsubscribe() is overriding Subscription._unsubscribe(), which is called inside Subscription.unsubscribe().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, didn't aware it's inherited from Subscription. thought it's inherited from Subscriber and tried to look Subscriber::_unsubscribe() instead.. my bad. :(

@kwonoj
Copy link
Member

kwonoj commented Nov 30, 2015

@staltz , would you able to rebase this one? #764 is now merged.

Fix catch operator to not have anymore a shared underlying Subscription, and instead reset the
subscription for each new observable replacing the caught error. This fixes a potential memory leak
if catch is used as an infinite retry, because subscriptions would be retained since the beginning,
and would increasing each time a catch is performed.

Resolves issue ReactiveX#763.
@staltz
Copy link
Member Author

staltz commented Nov 30, 2015

Rebased

@kwonoj
Copy link
Member

kwonoj commented Nov 30, 2015

Merged with 280f7ed, thanks @staltz

@kwonoj kwonoj closed this Nov 30, 2015
@staltz staltz deleted the fix-catch branch December 1, 2015 08:54
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants