-
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
Null check for BufferExactBoundedObserver #6499
Conversation
Other variants contain this Null check already, e.g. BufferExactUnboundedObserver It is causing 0.1% crashes in our production app.
I don't see how that scenario would be possible with just the exact buffer. Only the terminal events can set |
Also an unit test demonstrating the presumed bug has been fixed is required. |
Codecov Report
@@ Coverage Diff @@
## 2.x #6499 +/- ##
============================================
+ Coverage 98.27% 98.28% +<.01%
- Complexity 6291 6298 +7
============================================
Files 675 675
Lines 45163 45165 +2
Branches 6244 6246 +2
============================================
+ Hits 44386 44390 +4
- Misses 241 243 +2
+ Partials 536 532 -4
Continue to review full report at Codecov.
|
To be honest, I am trying to simulate the scenario past day and a half. Our app uses some PublishSubjects, but we switched mostly to PublishRelay. The scenario with disposing from multiple threads is possible.
|
That code path should not lead to NPE. The only way for |
I agree that it can be something wrong with the supplier.
It does not happen super often given the size of the app, but it is still a concern. If so, I can push the test which covers this (fails before change, passes after change):
|
In that case, use a failing supplier with an empty source. No threading necessary. Also the Flowable variant may be prone to the same issue. Could you check and fix that too? |
…nit test FlowableBufferTimed.BufferExactBoundedSubscriber - failing supplier fix + unit test
src/main/java/io/reactivex/internal/operators/flowable/FlowableBufferTimed.java
Outdated
Show resolved
Hide resolved
src/test/java/io/reactivex/internal/operators/flowable/FlowableBufferTest.java
Outdated
Show resolved
Hide resolved
src/test/java/io/reactivex/internal/operators/flowable/FlowableBufferTest.java
Outdated
Show resolved
Hide resolved
src/test/java/io/reactivex/internal/operators/observable/ObservableBufferTest.java
Outdated
Show resolved
Hide resolved
…riber NPE issue Reverted
Hi, |
I usually wait for @vanniktech's review, then if you think this is urgent, we can release soon after. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whops. Totally lost track of this! LGTM!
Improve stability of the library.
Other variants of the onComplete method include this Null check already, e.g. BufferExactUnboundedObserver, this check should fix the case when there is a race condition and buffer is already set to "null" by the time onComplete is called.
It is causing 0.1% crashes in our production app, this should improve stability of other apps too.