-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Stateful reconnect doesn't work as expected when using Redis backplane #55575
Comments
We have the same issue. Any updates? |
That's unfortunate. Seems like we should just pass the hub message type into We might want to in the future refactor some of the |
Is there an existing issue for this?
Describe the bug
Stateful reconnect requires that both client and server calculate the same sequence Id so when the reconnect happen they can resume on the right message, but when using Redis as backplane a different code path is used, which ends up causing some messages not being accounted for in the server side and creating a discrepancy that leads to lost messages on reconnect.
The whole sequence Id calculation happens in MessageBuffer class, which increases the Id every time an invocation message is sent (in WriteAsyncCore), skipping the count otherwise.
The problem is that when using Redis, the message comes as a SerializedHubMessage using a constructor that doesn't set the Message property, so when MessageBuffer tries to determine if it's an invocation message,
is
operator returns false as the message is null, and thus this message doesn't increment the sequence Id.On the client side is read correctly, identified as an Invocation, and increments the sequence Id, create a discrepancy that will essentially break stateful reconnect.
Expected Behavior
Sequence Id is kept in sync in both client side and server side. This is critical for stateful reconnect to work properly.
Steps To Reproduce
Exceptions (if any)
No response
.NET Version
8.0.3
Anything else?
The issue is pretty easy to spot once you know where to look.
Observe here how MessageBuffer.cs:124 expects Message property to be not null.

Observe here the constructor in SerializedHubMessage.cs:27 that is used by Redis backplane. No assignment of Message property.

Observe here how MessageBuffer.cs:161 checks message using

is
operator that will yield false as it is null, not incrementing the sequence Id as it should have.The text was updated successfully, but these errors were encountered: