Skip to content

1.x: fix ReplaySubject anomaly around caughtUp by removing that optimization#4051

Merged
akarnokd merged 1 commit into
ReactiveX:1.xfrom
akarnokd:ReplaySubjectCaughtUpFix
Jun 22, 2016
Merged

1.x: fix ReplaySubject anomaly around caughtUp by removing that optimization#4051
akarnokd merged 1 commit into
ReactiveX:1.xfrom
akarnokd:ReplaySubjectCaughtUpFix

Conversation

@akarnokd

Copy link
Copy Markdown
Member

Adding the backpressure support to ReplaySubject exposed a race condition around the caughtUp optimization.

The problem occurs when the source thread has caught up after drain() returned true but at the same time, a concurrent drain() starts running (due to a subscribe() process finishing or requesting on top of the previous Long.MAX_VALUE). This concurrent drain may think the replay hasn't started yet (by finding rp.node null) or seeing that the buffer has more elements (that may get double emitted).

The current solution is to remove this optimization until we come up with a correct optimization.

Related: #4028.

@akarnokd akarnokd added the Bug label Jun 21, 2016
@codecov-io

Copy link
Copy Markdown

Current coverage is 80.49%

Merging #4051 into 1.x will increase coverage by 0.11%

@@                1.x      #4051   diff @@
==========================================
  Files           253        253          
  Lines         16478      16469     -9   
  Methods           0          0          
  Messages          0          0          
  Branches       2500       2491     -9   
==========================================
+ Hits          13244      13256    +12   
+ Misses         2341       2331    -10   
+ Partials        893        882    -11   

Powered by Codecov. Last updated by 535fb75...788f3bd

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants