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

fromEmitter same-pool deadlock #4735

Closed
akarnokd opened this issue Oct 20, 2016 · 5 comments
Closed

fromEmitter same-pool deadlock #4735

akarnokd opened this issue Oct 20, 2016 · 5 comments

Comments

@akarnokd
Copy link
Member

This affects both 1.x and 2.x.

There is a question on StackOverflow where the example program hangs after it delivered the default bufferSize elements until the fromEmitter source completes.

The problem is that subscribeOn schedules the downstream's replenishing request on the same thread that is busy/sleeping and has no opportunity to update its internal requested amount. We had similar problems with onBackpressureBlock which had to be dropped.

We could introduce a subscribeOn mode in which it doesn't reschedule the request from downstream but it will confuse some and make wonder others.

@akarnokd
Copy link
Member Author

This was resolved in 2.x by making sure a subscribeOn after create doesn't reschedule downstream requests.

@bobvanderlinden
Copy link
Contributor

I think I'm running into this problem as well. fromEmitter suddenly stops emitting onNext items whereas the emitter itself is still being called.

I was using a single-thread-scheduler for the emitter, so I thought (from your explanation) that moving to a threadpool would resolve the problem. It apparently does not for my case. I'm probably misunderstanding what is going on behind the scenes.

Do you have any suggestions on how to workaround this issue (without moving to 2.x).

@akarnokd
Copy link
Member Author

akarnokd commented Jan 2, 2017

@bobvanderlinden Yes, use the NONE policy and apply onBackpressureXXX after subscribeOn.

@bobvanderlinden
Copy link
Contributor

@akarnokd That works like a charm! Thanks a lot!

@akarnokd
Copy link
Member Author

Closing via #5091 for 1.x and #4770 for 2.x.

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