Skip to content

Conversation

davidzhao
Copy link
Member

@davidzhao davidzhao commented Sep 13, 2023

When canUpdateOwnMetadata grant is given to the participant, and metadata is updated remotely, it would throw the client into an infinite loop in updating metadata with previous and current value.

This was really tricky to root cause. The way it happened was:

  • RoomService.UpdateParticipant is called
  • Participant.updateInfo called with new metadata
  • LocalParticipant.setName called with the same name
    • setName triggers a sendUpdateLocalMetadata with previous metadata
  • LocalParticipant.setMetadata called with new metadata
    • setMetadata triggers a sendUpdateLocalMetadata with new metadata
  • Participant.updateInfo called with old metadata....

When canUpdateOwnMetadata grant is given to the participant, and metadata
is updated remotely, it would throw the client into an invite loop in
updating metadata with previous and current value.

This was really tricky to root cause. The way it happened was:
* RoomService.UpdateParticipant is called
* Participant.updateInfo called with new metadata
* LocalParticipant.setName called with the same name
  * setName triggers a `sendUpdateLocalMetadata` with previous metadata
* LocalParticipant.setMetadata called with new metadata
  * setMetadata triggers a `sendUpdateLocalMetadata` with new metadata
* Participant.updateInfo called with old metadata....
@davidzhao davidzhao requested a review from lukasIO September 13, 2023 07:40
@changeset-bot
Copy link

changeset-bot bot commented Sep 13, 2023

🦋 Changeset detected

Latest commit: cfb8a55

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
livekit-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Sep 13, 2023

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 76.44 KB (+0.01% 🔺)
dist/livekit-client.umd.js 81.89 KB (+0.01% 🔺)

/**
* Updates metadata from server
**/
protected _setMetadata(md: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if LocalParticipant isn't supposed to implement this, should we make the method private?
(same question for _setName)

Copy link
Contributor

@lukasIO lukasIO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch!

@davidzhao davidzhao merged commit 76b02ec into main Sep 13, 2023
@davidzhao davidzhao deleted the dz-set-metadata branch September 13, 2023 07:50
@github-actions github-actions bot mentioned this pull request Sep 13, 2023
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 this pull request may close these issues.

2 participants