Skip to content

Null pointer when connecting to RSocket #24088

@jesty

Description

@jesty

I'm trying RSocket and I'm using:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.BUILD-SNAPSHOT</version>
        <relativePath/>
</parent>

My client code looks like:

requester
        .route("test")
        .retrieveFlow<Int>()
        .collect({
            println("Receiving $it")
        })

Starting from today I'm facing this exception:

	at java.util.Objects.requireNonNull(Objects.java:203) ~[na:1.8.0_202]
	at reactor.core.publisher.FluxSource.<init>(FluxSource.java:46) ~[reactor-core-3.3.1.BUILD-SNAPSHOT.jar:3.3.1.BUILD-SNAPSHOT]
	at reactor.core.publisher.Flux.wrap(Flux.java:9869) ~[reactor-core-3.3.1.BUILD-SNAPSHOT.jar:3.3.1.BUILD-SNAPSHOT]
	at reactor.core.publisher.Flux.from(Flux.java:961) ~[reactor-core-3.3.1.BUILD-SNAPSHOT.jar:3.3.1.BUILD-SNAPSHOT]
	at io.rsocket.RSocketRequester.requestChannel(RSocketRequester.java:174) ~[rsocket-core-1.0.0-RC5.jar:na]
	at io.rsocket.util.RSocketProxy.requestChannel(RSocketProxy.java:50) ~[rsocket-core-1.0.0-RC5.jar:na]
	at io.rsocket.util.MultiSubscriberRSocket.lambda$requestChannel$3(MultiSubscriberRSocket.java:47) ~[rsocket-core-1.0.0-RC5.jar:na]
	at reactor.core.publisher.FluxDefer.subscribe(FluxDefer.java:46) ~[reactor-core-3.3.1.BUILD-SNAPSHOT.jar:3.3.1.BUILD-SNAPSHOT]
	at reactor.core.publisher.Flux.subscribe(Flux.java:8128) ~[reactor-core-3.3.1.BUILD-SNAPSHOT.jar:3.3.1.BUILD-SNAPSHOT]
	at kotlinx.coroutines.reactive.PublisherAsFlow.collect(ReactiveFlow.kt:77) ~[kotlinx-coroutines-reactive-1.3.2.jar:na]
	at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1.collect(SafeCollector.kt:127) ~[kotlinx-coroutines-core-1.3.2.jar:na]
	at kotlinx.coroutines.flow.FlowKt__CollectKt.collect(Collect.kt:30) ~[kotlinx-coroutines-core-1.3.2.jar:na]
	at kotlinx.coroutines.flow.FlowKt.collect(Unknown Source) ~[kotlinx-coroutines-core-1.3.2.jar:na]

Some days ago everything works as expected, after replacing 2.2.2.BUILD-SNAPSHOT with 2.2.1.BUILD-SNAPSHOT, everything works again.

After debugging the problem seems to be in:

Flux<Payload> payloadFlux = this.payloadMono != null ?
					this.payloadMono.flatMapMany(rsocket::requestStream) :
					rsocket.requestChannel(this.payloadFlux);

With 2.2.1.BUILD-SNAPSHOT the null check returns true, while with 2.2.2.BUILD-SNAPSHOT the null check returns false.

I think that this happens because on this commit someone remove emptyPayload():

@Nullable
private Mono<Payload> payloadMono = emptyPayload();

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions