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

No backpressure (unlimited buffers) when using ExecutionModel.SynchronousExecution #1670

Open
ghik opened this issue Nov 16, 2022 · 2 comments

Comments

@ghik
Copy link
Contributor

ghik commented Nov 16, 2022

Using ExecutionModel.SynchronousExecution has some very surprising and dangerous consequences that are not mentioned in its documentation.

Namely, the value of ExecutionModel.recommendedBatchSize (which is close to Int.MaxValue for SynchronousExecution) is used as default buffer size when converting a Reactive Streams Publisher to Observable (Observable.fromReactivePublisher). This basically means that the buffer becomes unbounded and effectively turns off backpressure and quickly exhausts available memory, leading to catastrophic failures.

My understanding of ExecutionModel.recommendedBatchSize (as explained by its documentation) is that it only affects the internal trampoline of Scheduler, controlling the frequency of asynchronous boundaries. In my opinion it should not affect other places like the culprit buffer size.

@alexandru
Copy link
Member

This might be the case indeed. Thanks for the report.

@ghik
Copy link
Contributor Author

ghik commented Nov 17, 2022

Note: the original reason why we switched to ExecutionModel.SynchronousExecution is #1672 - which is interesting on its own.

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

No branches or pull requests

2 participants