Reproduced with RxJava version: 2.1.9 and 2.2.3.
Flowable.just(Boolean.TRUE)
.repeat()
.concatMap(token -> Flowable.just("foo").doOnCancel(() -> System.out.println("Cancelled")))
.subscribe();
Expected behavior: "Cancelled" should not appear on the console
Current behavior: "Cancelled" is printed as a result of cancel invocation.
Note that flatMap(token -> ..., 1) don't have this issue but it is significantly slower than concatMap()