Skip to content

MetaData Push rejects meta data in Payload when using block() #1033

Closed

Description

@abuijze

Expected Behavior

Regardles whether someone uses rsocket.metadataPush(...).block(); or rsocket.metadataPush(...).subscribe(...);, the behavior (besides the blocking aspect) should be identical.

Actual Behavior

When using the block() method, the operation results in a java.lang.IllegalArgumentException: Metadata push does not support metadata field. The subscribe() method does produce the expected result.

Steps to Reproduce

Mono<CloseableChannel> server = RSocketServer.create()
                                                     .acceptor((setup, sendingSocket) -> Mono.just(new RSocket() {
                                                         @Override
                                                         public Mono<Void> metadataPush(Payload payload) {
                                                             return Mono.empty();
                                                         }
                                                     }))
                                                     .bind(TcpServerTransport.create(8024));
        CloseableChannel closeable = server.blockOptional().orElseThrow();
        try {
            RSocket client = RSocketConnector.connectWith(TcpClientTransport.create(8024))
                                             .block();

            assertDoesNotThrow(() -> client.metadataPush(DefaultPayload.create("ignored", "payload")).block());
        } finally {
            closeable.dispose();
        }

Possible Solution

The MetadataPushRequesterMono class implements a block() method with clearly different semantics than the subscribe() method. Since that class extends Mono, the whole block() method is probably unnecessary. The implementation can use the block() implementation of Mono, which calls the subscribe() using a BlockingMonoSubscriber

Looking at the implementation of BlockingMonoSubscriber it also seems that the block(Duration) implementation doesn't take the given duration into account. Removing the method would use Mono's implementation, which does only block for the given duration.

Your Environment

  • RSocket version(s) used: 1.1.0 and 1.1.1 produce the issue. 1.0.4 doesn't.
  • For the test case, I used rsocket-core and rsocket-transport-netty

Activity

  1. modified the milestone: 1.1.2 on Mar 18, 2022
  2. OlegDokuka commented on Mar 18, 2022

    @OlegDokuka
    Member

    close in favor of existing PR (#1034)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    supersededIssue is superseded by another

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions