Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestStream messages are truncated usually after the 1st message frame #24

Open
rupweb opened this issue Feb 17, 2021 · 0 comments
Open
Labels
bug Something isn't working

Comments

@rupweb
Copy link

rupweb commented Feb 17, 2021

Per this SO for a net client (with either binary or string data encoding) the 1st message is received and treated properly and usually the 2nd but from then on messages are truncated. This causes a crash at RSocketProtocol.Handler.cs where the header type is unknown and therefore not handled.

To replicate the error start a Java spring boot RSocket server. Then spin up a net client with code like this:

var client = new RSocketClient(new WebSocketTransport("ws://127.0.0.1:7000/"));

Console.WriteLine("Connect Async");
await client.ConnectAsync(new RSocketOptions()
{ 
  DataMimeType = "application/json",
  MetadataMimeType = "message/x.rsocket.routing.v0"
});

Console.WriteLine("Requesting Raw Stream...");

string json = "{\"StartServerStream\":\"Y\"}";

string route = "quotes";
byte[] intBytes = BitConverter.GetBytes(6);
string stringBytes = Encoding.Default.GetString(intBytes, 0, 1);
string metaData = stringBytes + route;

var stringclient = new RSocketClient.ForStrings(client);
await stringclient.RequestStream(json, metaData)
    .ForEachAsync((result) =>
    {
        Console.WriteLine($"Result ===> {result}");
    }); 

The server uses webflux to stream back to the client. Get the RSocket.Core and put a breakpoint at https://github.com/rsocket/rsocket-net/blob/master/RSocket.Core/RSocketProtocol.Handler.cs#L30

If you watch the message sizes coming in, the 1st message size is what you expect from your server (fielding dummy messages) but the next message sizes are unexpected.

@rupweb rupweb changed the title Message is truncated usually after the 1st message frame RequestStream messages are truncated usually after the 1st message frame Feb 17, 2021
@OlegDokuka OlegDokuka added the bug Something isn't working label Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants