question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improper `Payload#hasMetadata` behavior.

See original GitHub issue

I was debugging some rust codes which send a REQUEST_RESPONSE without metadata. Unexpectedly, I received a PAYLOAD frame with a metadata (blank string). ServerSide is very simple:

package com.example.rsocket;

import io.rsocket.AbstractRSocket;
import io.rsocket.Payload;
import io.rsocket.RSocketFactory;
import io.rsocket.transport.netty.server.TcpServerTransport;
import io.rsocket.util.DefaultPayload;
import java.lang.invoke.MethodHandles;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;

/**
 * Echo
 *
 * @author jeffsky
 * @since 2020-03-29
 */
public class Echo {

  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

  public static void main(String[] args) {
    RSocketFactory.receive()
        .fragment(1024)
        .acceptor(
            (setup, sendingSocket) ->
                Mono.just(
                    new AbstractRSocket() {
                      @Override
                      public Mono<Payload> requestResponse(Payload payload) {
                        log.info(
                            "> data={}, meta={}, has_metadata={}",
                            payload.getDataUtf8(),
                            payload.getMetadataUtf8(),
                            payload.hasMetadata());
                        return Mono.just(payload);
                      }
                    }))
        .transport(TcpServerTransport.create(7878))
        .start()
        .block()
        .onClose()
        .block();
  }
}

Console show below:

20:50:42.703 [reactor-tcp-nio-2] DEBUG io.rsocket.FrameLogger - receiving -> 
Frame => Stream ID: 1 Type: REQUEST_RESPONSE Flags: 0b0 Length: 15
Data:
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 48 65 6c 6c 6f 52 75 73 74                      |HelloRust       |
+--------+-------------------------------------------------+----------------+
20:50:42.705 [reactor-tcp-nio-2] INFO  com.example.rsocket.Echo - > data=HelloRust, meta=, has_metadata=true

The problem I thought is that has_metadata should be false because the frame flags is 0b0 already.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
jjeffcaiicommented, Apr 24, 2020

@OlegDokuka I’ve tested it. RC-7 is OK now. Thanks! 👍

0reactions
OlegDokukacommented, Apr 24, 2020

@jjeffcaii IT is fixed. Please let me know if you still experiencing this issue in RC-7-SNAPSHOT

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Blockchain and Low Power in Smart Cities to internet of ...
this behavior, which varies according to the chosen data rate. ... The payload has metadata with the address of the API destination of....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found