-
Notifications
You must be signed in to change notification settings - Fork 3k
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(Subscriber): don't leak destination #6116
fix(Subscriber): don't leak destination #6116
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is okay... I'd just want to see if this works okay when you chain together a few operators. We altered OperatorSubscriber
, but there's no new tests for operators related to that, so it has me a little concerned.
I'm not sure what additional tests you might be looking for. There are no explicit tests for rxjs/spec/operators/mergeMap-spec.ts Lines 307 to 311 in 3ab3f6f
Regarding the rxjs/spec/operators/bufferWhen-spec.ts Lines 184 to 211 in 3ab3f6f
rxjs/spec/operators/zipAll-spec.ts Lines 345 to 365 in 3ab3f6f
rxjs/spec/operators/zipAll-spec.ts Lines 222 to 240 in 3ab3f6f
So I'm not sure what else needs to be tested. |
That makes sense, thanks @cartant |
Description:
This PR adds a failing test that shows that subscriptions - i.e. subscribers - returned from
subscribe
leak their destinations - i.e. their observers or callbacks.The PR changes
Subscriber#unsubscribe
to null thedestination
aftersuper.unsubscribe
is called.This change broke three operators -
bufferWhen
was one of them - because if unsubscription was effected withinonNext
and if an error was thrown from withinonNext
(after the unsubscription) it'd be caught in theOperatorSubscriber
and an attempt would be made to callthis.destination.error
, butthis.destination
would benull
.Rather than capture
this.destination
before thetry/catch
aroundonNext
,onComplete
, andonError
, I just used thedestination
that was passed in to theOperatorSubscriber
constructor - AFAICT, we can be sure that it's aSubscriber
, becauseOperatorSubscriber
is an internal, impementation detail.Related issue (if exists): Nope, but there is a discussion: #6115