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

1.x: fix: bounded replay() not requesting enough for latecommers #3454

Merged
merged 1 commit into from Dec 14, 2015

Conversation

Projects
None yet
3 participants
@akarnokd
Member

akarnokd commented Oct 16, 2015

Fixes the bug reported in #3452.

The fix involves 3 changes:

  • First, each node in the bounded buffer receives an incrementing index whenever they are created. The root node starts with 0, the first value's index will be 1 and so on.
  • In the replay logic, the very first time the current node is captured, the node's index is added to the totalRequested amount of the subscriber. Since this is always one less than the max requested that far, there is no point in calling manageRequests() at this point.
  • Third, the pinning of the current node has to happen before the child requests, otherwise the difference would manifest before the compensation and some elements may get missed.

In addition, there was a missing r-- in the emission loop and thus the operator could have overflown its child subscriber.

@benjchristensen

This comment has been minimized.

Show comment
Hide comment
@benjchristensen

benjchristensen Oct 20, 2015

Member

Don't have the time to fully grok this, but the changes look okay and I trust @akarnokd on this. So 👍

Member

benjchristensen commented Oct 20, 2015

Don't have the time to fully grok this, but the changes look okay and I trust @akarnokd on this. So 👍

@akarnokd

This comment has been minimized.

Show comment
Hide comment
@akarnokd

akarnokd Oct 20, 2015

Member

Thank you @benjchristensen. Since replay() is one of the most complicated operators, I'd like @abersnaze or @stealthcode to look at it before it ends up in 1.0.15.

Member

akarnokd commented Oct 20, 2015

Thank you @benjchristensen. Since replay() is one of the most complicated operators, I'd like @abersnaze or @stealthcode to look at it before it ends up in 1.0.15.

@stealthcode

This comment has been minimized.

Show comment
Hide comment
@stealthcode

stealthcode commented Dec 14, 2015

👍

akarnokd added a commit that referenced this pull request Dec 14, 2015

Merge pull request #3454 from akarnokd/ReplayRequestCoordinationFix
1.x: fix: bounded replay() not requesting enough for latecommers

@akarnokd akarnokd merged commit 3be980d into ReactiveX:1.x Dec 14, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@akarnokd akarnokd deleted the akarnokd:ReplayRequestCoordinationFix branch Dec 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment