Skip to content

2.x: parallel blocks forever with TestScheduler #6355

@asarkar

Description

@asarkar

io.reactivex.rxjava2:rxjava:2.2.3

public class DemoApplication {
   public static void main(String[] args) {
       List<Map.Entry<Integer, String>> entries = Arrays.asList(
               new AbstractMap.SimpleImmutableEntry<>(3, "hello"),
               new AbstractMap.SimpleImmutableEntry<>(3, "world")
       );

       Flowable.fromIterable(entries)
               .flatMap(entry -> Flowable.range(1, entry.getKey())
                       .parallel()
                       .runOn(Schedulers.io())
                       .flatMap(i -> logIt(entry.getValue()).toFlowable())
                       .sequential()
               )
               .all(success -> success)
               .doOnSuccess(success -> System.out.println("good"))
               .doOnError(Throwable::printStackTrace)
               .blockingGet();
   }

   private static Single<Boolean> logIt(String s) {
       System.out.println(s);

       return Single.just(true);
   }
}

This code works as expected. However, replacing Schedulers.io() with TestScheduler blocks forever. Gradle project attached.

demo.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions