Skip to content

Conversation

@sgc-code
Copy link
Contributor

IoScheduler releases the workers back to the pool to be reused optimistically to reduce the number of threads being created. This could lead to deadlocks in some situations like this one:

Flowable.just("item") .observeOn(Schedulers.io()) .firstOrError() .subscribe(__ -> { for (int i = 0; i < 200; i++) { Completable.complete() .observeOn(Schedulers.io()) .blockingAwait(); } System.out.println("Will never reach this"); }); 

As discussed on #7153, this PR allow to configure this behaviour.
Enabling rx3.io-scheduled-release will guarantee that workers are not reused until all the processing has finished.

Once we merge this we, I can create a similar PR for the 2.x branch

@codecov
Copy link

codecov bot commented Jan 25, 2021

Codecov Report

Merging #7160 (526d600) into 3.x (e46ce76) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@ ## 3.x #7160 +/- ## ============================================ + Coverage 99.49% 99.53% +0.03%  Complexity 6708 6708 ============================================ Files 745 745 Lines 47327 47332 +5 Branches 6375 6376 +1 ============================================ + Hits 47089 47111 +22  + Misses 104 98 -6  + Partials 134 123 -11 
Impacted Files Coverage Δ Complexity Δ
...va/io/reactivex/rxjava3/schedulers/Schedulers.java 100.00% <ø> (ø) 12.00 <0.00> (ø)
...tivex/rxjava3/internal/schedulers/IoScheduler.java 97.91% <100.00%> (+0.11%) 9.00 <0.00> (ø)
...l/operators/observable/ObservableFlatMapMaybe.java 91.54% <0.00%> (-4.23%) 2.00% <0.00%> (ø%)
...java3/internal/operators/flowable/FlowableZip.java 98.97% <0.00%> (-1.03%) 6.00% <0.00%> (ø%)
.../operators/observable/ObservableCombineLatest.java 99.38% <0.00%> (-0.62%) 6.00% <0.00%> (ø%)
...a/io/reactivex/rxjava3/subjects/ReplaySubject.java 99.16% <0.00%> (+0.20%) 49.00% <0.00%> (ø%)
...ternal/operators/observable/ObservableGroupBy.java 100.00% <0.00%> (+0.54%) 2.00% <0.00%> (ø%)
...rnal/operators/flowable/FlowableFlatMapSingle.java 94.18% <0.00%> (+0.58%) 2.00% <0.00%> (ø%)
.../operators/observable/ObservableFlatMapSingle.java 96.03% <0.00%> (+0.79%) 2.00% <0.00%> (ø%)
.../operators/maybe/MaybeFlatMapIterableFlowable.java 100.00% <0.00%> (+0.81%) 2.00% <0.00%> (ø%)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e46ce76...526d600. Read the comment docs.

@akarnokd akarnokd merged commit e657635 into ReactiveX:3.x Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants