-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
buffer() using TimeAndSizeBasedChunks incorrectly forces thread into interrupted state #428
Comments
Can you provide a unit test to demonstrate the issue? Here are existing unit tests for buffer: https://github.com/Netflix/RxJava/blob/master/rxjava-core/src/main/java/rx/operators/OperationBuffer.java#L372 Also, what Future are you referring to? Are you using custom schedulers? |
I'm unable to run the unit tests in eclipse for some reason. Here's a unit test from my project. While we're on the subject of buffer() it would be nice if the observer was not called with an empty list.
|
Regarding the Future, no, i'm not using a custom scheduler. Subscriptions.create(final Future<?> f) calls cancel on the future when it is unsubscribed. |
Yes, that's what a Subscription of a Future is supposed to do. |
Thanks for submitting the unit test, I'll try it out.
You're using time, so it will emit every 1000ms whatever is buffered, even if it's empty. |
In TimeAndSizeBasedChunks.emitChunk, if emitChunk is called from the scheduled action in createChunk (i.e from the timeout thread), calling subscription.unsubscribe() ends up calling cancel() on the future which sets the thread's interrupted state to true. This state has an adverse effect on any blocking call performed in that thread.
The text was updated successfully, but these errors were encountered: