-
Notifications
You must be signed in to change notification settings - Fork 357
Closed
Labels
Description
We've some periodically failing tests. I modified one of the rsocket-java samples to demonstrate. It sends 10 messages, expects them echoed back, followed by onComplete. It repeats this in a loop up to 1000 times. Once in a while it fails to get onComplete after the 10 items are echoed back.
public final class ChannelEchoClient {
public static void main(String[] args) {
RSocketFactory.receive()
.acceptor(new SocketAcceptorImpl())
.transport(TcpServerTransport.create("localhost", 7000))
.start()
.subscribe();
RSocket socket =
RSocketFactory.connect()
.transport(TcpClientTransport.create("localhost", 7000))
.start()
.block();
for (int i=0; i < 1000; i++) {
System.out.println("Iteration: " + (i + 1));
Flux<String> result = socket
.requestChannel(Flux.range(1, 10).map(idx -> DefaultPayload.create("Hello[" + idx + "]")))
.map(Payload::getDataUtf8)
.log();
StepVerifier.create(result)
.expectNext("Echo: Hello[1]").expectNextCount(8).expectNext("Echo: Hello[10]")
.expectComplete()
.verify(Duration.ofSeconds(5));
}
}
private static class SocketAcceptorImpl implements SocketAcceptor {
@Override
public Mono<RSocket> accept(ConnectionSetupPayload setupPayload, RSocket reactiveSocket) {
return Mono.just(
new AbstractRSocket() {
@Override
public Flux<Payload> requestChannel(Publisher<Payload> payloads) {
return Flux.from(payloads)
.delayElements(Duration.ofMillis(10))
.map(Payload::getDataUtf8)
.map(s -> "Echo: " + s)
.map(DefaultPayload::create);
}
});
}
}
}
I don't know if the expectation is valid but it seems to work that way most of the time. I want to say the failures started 2-3 weeks ago, possibly around the time we upgraded to 0.12.1-RC3 snapshots from 0.11.17 but I'm not 100% sure since our CI server only keeps 100 builds. The oldest failures I could find are from 2 weeks ago.