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

Ghost avatar in the room after the user auto reconnect (master branch) #21

Open
vincentfretin opened this issue Nov 1, 2021 · 0 comments · May be fixed by networked-aframe/janus-plugin-sfu#6

Comments

@vincentfretin
Copy link
Member

I document the issue here I had some time ago (july 2021) when I switched my project from 3.0.x to master https://github.com/networked-aframe/naf-janus-adapter/tree/9cb7aa402141352b0c0ba09399eef30c1deafd8a
I was using janus-plugin-sfu master https://github.com/mozilla/janus-plugin-sfu/tree/f9e56d8f540fc4acabbff1f6e16acea2d528fb63 at that time.

After I switched to master, I had several reports of duplicate avatars from users having bad connection so triggering the auto reconnection with the same clientId. I saw the issue once in a meeting, but couldn't reproduce it myself.
The duplicate avatar is seen by all participants and the user themselves and never goes away (until the user leaves the meeting I think).

I currently reverted back to using the 3.0.x branch in my project and I didn't receive reports of the issue since then.

I dug a little bit in the code to see what could trigger this behavior. Here is my findings.

Normally when a user reconnects, we should have a leave event, that should remove the avatar, followed by a join event that creates the avatar. There is a comment about when to notify the leave event in this part of the code
https://github.com/mozilla/janus-plugin-sfu/blob/ef815ec2c23030035aaef7047db57368c1fabfca/src/lib.rs#L336-L342
We should maybe indeed send the leave event when the publisher session ends, and not wait for all the other subscribers sessions to end?

There may be a race condition between destroying all sessions (the publisher and subscribers) and creating the new sessions.
With the current logic in the Rust code, the leave event may not be sent if the following order happen I think:

  • the user has a temporary disconnect
  • janus detects the connection closed and ends the publisher session
  • the user creates the new publisher session, a join event is sent to the other participants
  • janus ends the old subscribers sessions
  • the leave event is never triggered because we have still a session for this userid
  • new subscribers sessions are created

With the naf-janus-adapter 3.0.x branch, when it receives a join event, and if the participant is already registered, it removes it completely before adding the participant again, thus removing the previous entities including the avatar of the user.
On master branch, this logic doesn't apply anymore. It just does nothing.

I don't know how we can revert back to the old behavior of removing and readding the user with the new syncOccupants API on master. Or maybe the real fix should be on the Rust side? I don't know.

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

Successfully merging a pull request may close this issue.

1 participant