Skip to content

ReplaySubject and buffer with debounce not emitting values after first subscription #6608

@riclage

Description

@riclage

The issue described below started with version 2.2.10 and continues with 2.2.11. It works with 2.2.7 through 2.2.9.

I have a test where a set a ReplaySubject like so:

locationPublisher = ReplaySubject.create()
locationPublisher.onNext(mockLocation)
locationPublisher.onComplete()

locationObservable = locationPublisher.share()

Then, I subscribe twice to the observable (I'm simplifying the test case just to demonstrate the bug):

        locationObservable
            .buffer(locationObservable.debounce(5, TimeUnit.SECONDS))
            .test()
            .assertValueCount(2)


        locationObservable
            .buffer(locationObservable.debounce(5, TimeUnit.SECONDS))
            .test()
            .assertValueCount(2)

When I run the above test, it fails on the second test subscription on RxJava 2.2.10 or 2.2.11:

java.lang.AssertionError: Value counts differ; expected: 2 but was: 1 (latch = 0, values = 1, errors = 0, completions = 1)
Expected :2
Actual :1 (latch = 0, values = 1, errors = 0, completions = 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions