rsocket / rsocket-js

JavaScript implementation of RSocket

Home Page:https://github.com/rsocket/rsocket-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deserialization error in the RSocketServer

palamccc opened this issue · comments

I'm trying to use RSocketServer in javascript, but when I provide serializers option, the frames are getting deserialized twice.

const server = new RSocketServer<string, string>({
    // ....
   getRequestHandler: socket => ({
      requestChannel: payloads => handleRequestChannel(socket, payloads),
    }),
    serializers: JsonSerializers,
});

I added breakpoints and found the two locations where it is getting deserialized.

The first deserialization is happening here,
https://github.com/rsocket/rsocket-js/blob/v0.0.27/packages/rsocket-core/src/RSocketMachine.js#L711-L714

The second deserialization is happening here,
https://github.com/rsocket/rsocket-js/blob/v0.0.27/packages/rsocket-core/src/RSocketMachine.js#L832

During second deserialization RSocketServer is crashing with this error,

image

Expected Behavior

The frame should be deserialized only once.

Actual Behavior

It's getting deserialized in two places in the data pipeline.

Steps to Reproduce

I don't have a test case at the moment.

Possible Solution

Review the data pipeline and remove the second deserialization.
Add a test case to test serializers

Your Environment

  • RSocket version(s) used: 0.0.27
  • Other relevant libraries versions (eg. netty, ...):
  • Platform (eg. JVM version (javar -version) or Node version (node --version)):
  • OS and version (eg uname -a):