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

Problem with Flowable.generate() (RxJava 2) #4931

Closed
smiklos opened this issue Dec 20, 2016 · 2 comments
Closed

Problem with Flowable.generate() (RxJava 2) #4931

smiklos opened this issue Dec 20, 2016 · 2 comments

Comments

@smiklos
Copy link

smiklos commented Dec 20, 2016

I'm using RxJava version 2.0.2 and wanted to implement a some logic using Flowable.generate.

Based on the documentation, if I emit more than one item in when calling onNext on the emitter instance, I should get an IllegalStateException, but in reality I experience a different behavior:

Taking this example:

 Flowable<Object> test = Flowable.generate(emitter -> {
            emitter.onNext("test");
            emitter.onNext("test more");
        }).observeOn(Schedulers.io(), false,5)
          .doOnNext(System.out::println);
        test.blockingSubscribe();

I get this error: io.reactivex.exceptions.MissingBackpressureException: Queue is full?!

and if I just try:

    Flowable<Object> test = Flowable.generate(emitter -> {
            emitter.onNext("test");
            emitter.onNext("test more");
        })
       .doOnNext(System.out::println);
        test.subscribe();

then it just pushes the values indefinitely.

@akarnokd
Copy link
Member

Thanks, this is a bug with generate not having the necessary safeguards. I'll post a fix shortly.

@akarnokd
Copy link
Member

Closing via #4932

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

No branches or pull requests

2 participants