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

Spaces SDK gets stuck after channel is suspended and reconnects #331

Open
ajaffie opened this issue Jul 30, 2024 · 2 comments
Open

Spaces SDK gets stuck after channel is suspended and reconnects #331

ajaffie opened this issue Jul 30, 2024 · 2 comments

Comments

@ajaffie
Copy link

ajaffie commented Jul 30, 2024

I've been trying to fix this bug where users are seeing themselves in a space and other users see that user in the space when they aren't there. I eventually figured out that the bug is caused by the user disconnecting long enough for the connection and channel to be suspended and returning later without refreshing the page. The Ably SDK seems to reconnect fine, and the channel re-attaches, but the space enters an irrecoverable state.
I think what's happening is the space is hanging on to the original connection id while the Ably SDK uses a new one. A few pieces of evidence support this:

  • The affected user sees an entry in others that matches their client id and profile but with the original connection id
  • Until the affected user refreshes, they cannot leave any space they entered before disconnecting

When trying to leave an affected space, this error occurs: Error: must enter a space to perform this operation.
Seems to be caused by calling getByConnectionId with the outdated connection id here

Let me know if there's anything else I can do to help.

@VeskeR
Copy link
Contributor

VeskeR commented Aug 1, 2024

Hi @ajaffie ! Thank you for bringing this to our attention.

Could you please provide a reproducible example or code samples showing how you are using the Spaces SDK, along with the steps you take to reproduce the issue?

@ajaffie
Copy link
Author

ajaffie commented Oct 23, 2024

Sorry about the long delay.
You can actually reproduce this issue on the Spaces demo site. All you need to do is go to one of the slides, disconnect from the network or simulate offline using browser dev tools, wait until the "Presence state is out of sync due to channel being in the SUSPENDED state" error log, then reconnect. You will get lots of "Gn: must enter a space to perform this operation" error logs and you'll have a duplicate entry at the top of the page. The demo site actually locks up as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants