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(operator): Fix take to complete when the source is re-entrant. #1967

Merged
merged 1 commit into from
Sep 22, 2016

Conversation

trxcllnt
Copy link
Member

Description:
The TakeSubscriber compares the instance variable count to determine if it should complete or not.

If the source Observable is re-entrant, this check fails (because count is updated in each next), and take never completes.

I encountered this issue with expand and take on a multicast Observable, but here's a much simpler repro example:

import { Subject } from 'rxjs';

const subject = new Subject();

subject
  .take(10)
  .subscribe(
    (i) => {
      console.log(i);
      subject.next(i + 1);
    },
    (err) => {},
    () => console.log('done') // never gets printed
  );

subject.next(0);

The TakeSubscriber compares the instance variable `count` to determine if it should complete or not.

If the source Observable is re-entrant, this check fails (because `count` is updated in each `next`), and take never completes.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0005%) to 97.001% when pulling 86615cb on trxcllnt:fix-re-entrant-take-completion into 646b38d on ReactiveX:master.

@kwonoj
Copy link
Member

kwonoj commented Sep 22, 2016

LGTM

@lock
Copy link

lock bot commented Jun 6, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
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.

3 participants