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

"Unknown resume token" error #32062

Closed
spiralgo opened this issue Aug 10, 2022 · 2 comments
Closed

"Unknown resume token" error #32062

spiralgo opened this issue Aug 10, 2022 · 2 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@spiralgo
Copy link

spiralgo commented Aug 10, 2022

Expected Behavior

We use react-js on client side with this resume code:

  resume: {

     tokenGenerator: () => Buffer.from(clientUuid),
     reconnectFunction: (attemptCount) =>
       new Promise((resolve, reject) => {
         if(attemptCount > 9) reject();
         console.log("reconnect attempt: " +  attemptCount);
         setTimeout(resolve, 9 * 1000);
       })    
   }

We use spring-boot-starter-rsocket on the server side.
We expect it resumes after the shutdown and restart the Spring server.

Actual Behavior

We get this error on the client side:

Error: Closed. Original cause [Error: Incomplete RESUME handshake. Unexpected frame 11 received].
    at ClientServerInputMultiplexerDemultiplexer.close (ClientServerMultiplexerDemultiplexer.js?862d:176:1)
    at eval (ClientServerMultiplexerDemultiplexer.js?862d:387:1)
    at Deferred.onClose (Deferred.js?efc5:89:1)
    at ResumeOkAwaitingResumableClientServerInputMultiplexerDemultiplexer.handle (ClientServerMultiplexerDemultiplexer.js?862d:386:1)
    at WebsocketDuplexConnection._this.handleMessage (WebsocketDuplexConnection.js?733e:51:1)

When we debug, we also see the message: "unknown resume token".

Steps to Reproduce

export const createConnector = (url: string, clientUuid: string) => {

  const connector = new RSocketConnector({

    setup: {
      // ms btw sending keepalive to server
      keepAlive: 60000,
      // ms timeout if no keepalive response
      lifetime: 180000,
      payload: {
        data: Buffer.from(clientUuid),
        metadata: Buffer.from(String.fromCharCode(clientUuid.length) + clientUuid)
      },
      // format of `data`
      dataMimeType: 'application/json',
      // format of `metadata`
      metadataMimeType: 'message/x.rsocket.routing.v0',
    },
    transport: new WebsocketClientTransport({
      url: url
    }),
    resume: {

      tokenGenerator: () => Buffer.from(clientUuid),
      reconnectFunction: (attemptCount) =>
        new Promise((resolve, reject) => {
          if(attemptCount > 9) reject();
          console.log("reconnect attempt: " +  attemptCount);
          setTimeout(resolve, 9 * 1000);
        })    
    }
  });

  return connector;
};

For JAVA, just use the default configuration for spring-boot-starter-rsocket with this yml:

spring:
  rsocket:
    server:
      mapping-path: /websocket
      transport: websocket
      port: 8081

Possible Solution

The root cause for this error might be that the server validates token using in-memory store, Implementing a permanent store for tokens might help.

Your Environment

package.json

    "rsocket-core": "^1.0.0-alpha.1",
    "rsocket-types": "^0.0.27",
    "rsocket-websocket-client": "^1.0.0-alpha.1",

gradle:
implementation 'org.springframework.boot:spring-boot-starter-rsocket'

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 10, 2022
@snicoll
Copy link
Member

snicoll commented Aug 10, 2022

Please do not cross-post, especially without indicating that you have done so rsocket/rsocket-js#243

@philwebb
Copy link
Member

The root cause for this error might be that the server validates token using in-memory store

I assume this is referring to io.rsocket.resume.InMemoryResumableFramesStore. AFAICT there are no other implementations that we can configure from Spring Boot. You might be able to write your own and use a RSocketServerCustomizer to plug it in.

I'm going to close this one because I don't think there's anything we can do in Spring Boot about this.

@philwebb philwebb added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 19, 2022
@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

4 participants