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

3.x: Change the behavior of Flowable.groupBy to signal MBE if no main requests #6641

Closed
akarnokd opened this issue Aug 29, 2019 · 1 comment · Fixed by #6740
Closed

3.x: Change the behavior of Flowable.groupBy to signal MBE if no main requests #6641

akarnokd opened this issue Aug 29, 2019 · 1 comment · Fixed by #6740

Comments

@akarnokd
Copy link
Member

Currently, the Flowable.groupBy queues up groups until the downstream requests more groups. Unfortunately, this can lead to hangs because if there are more groups than requested, active groups may starve out as they don't trigger replenishments or those replenishments result in more groups to be created. Example:

Flowable.range(1, 1000)
.groupBy(v -> v)
.flatMap(v -> v, 16)
.test()
.assertValueCount(1000)
.assertComplete();

This case works if flatMap's concurrency level is greater or equal to the expected group count.

I propose changing the Flowable.groupBy operator to signal MissingBackpressureException if the direct downstream is not ready to receive more groups.

@akarnokd akarnokd added this to the 3.0 milestone Aug 29, 2019
@akarnokd akarnokd changed the title 3.x: Change the behavior Flowable.groupBy to signal MBE if no main requests 3.x: Change the behavior of Flowable.groupBy to signal MBE if no main requests Aug 29, 2019
@akarnokd
Copy link
Member Author

This is a tough one. Many tests break because of the non-consumed groups or hang because of request management issues. I'll have to rework the tests and come up with the correct request management logic.

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

Successfully merging a pull request may close this issue.

1 participant