Skip to content

Ordering of onSubscribe and request signals will change depending on whether subscribeOn is called. #2797

Closed
@paul-k-young

Description

@paul-k-young

These two blocks of code produce different orderings of the onSubscribe and request events.

    Flux.just(3,5,11)
        .log("step1")
        .map(x -> x*x)
        .log("step2")
        .collectList()
        .log("step3")
        .block();

    Flux.just(3,5,11)
        .log("step1")
        .subscribeOn(schedulerA)
        .map(x -> x*x)
        .log("step2")
        .subscribeOn(schedulerB)
        .collectList()
        .log("step3")
        .subscribeOn(schedulerC)
        .block();

The first block shows the following sequence:
step1: onSubscribe
step2: onSubscribe
step3: onSubscribe
step1: request
step2: request
step3: request

Whereas the second block shows this sequence:
step3: onSubscribe
step3: request
step2: onSubscribe
step2: request
step1: onSubscribe
step1: request

It appears that ordering of subscribeOn and request signals isn't guaranteed. That said, @smaldini suggested I raise the issue as it might adversely impact metrics.

Here's the test case with logs:
ReactorTest2.java.zip

Metadata

Metadata

Assignees

Labels

status/invalidWe don't feel this issue is valid, or the root cause was found outside of Reactor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions