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

Race condition may cause JitsiConference.prototype._doReplaceTrack to hang forever #2370

Open
athouary opened this issue Oct 10, 2023 · 1 comment

Comments

@athouary
Copy link
Contributor

Description

I consume lib-jitsi-meet in a custom user interface to connect and use a self-hosted docker-jitsi-meet. I've encountered some cases where the promise returned byJitsiConference.addTrack is pending forever, and after long researches, I've finally understood why.

The JitsiConference.prototype._doReplaceTrack promise resolves once the replaceTrack on all the existing Jingle Session (P2P and/or JVB) resolve. JingleSessionPC relies on AsyncQueue and pushes the replaceTrack call into it. In some rare case, when a 3rd user joins the conference and it goes from P2P to JVB, then the P2P JingleSession closes and the AsyncQueue is killed. This results in the replaceTrack to be pending forever.

Current behavior

A call to JitsiConference.addTrack or JitsiConference.replaceTrack may hang forever if the conference goes from P2P to JVB in the mean time.

Expected Behavior

The promises returned by those functions should either be resolved or rejected. Actually, it should most probably resolve and ignore the P2P session since it's not relevant anymore.

Possible Solution

We should probably call the all the pending task callbacks when killing an AsyncQueue, with a specific error that replaceTrack would catch. It would then resolve its promise (it seems ok not to manage to replace a track on a non-existing peer connection).

A more simple but dirtier solution would be to reject the promise after a timeout.

Steps to reproduce

  1. Client A joins a Jitsi conference
  2. Client B joins a Jitsi conference
  3. Client A adds local tracks to the conference
  4. Client B adds local tracks to the conference
  5. Client C joins the conference before the tracks are completely added for one or both other users

Environment details

Reproduced on (non-exhaustive):

  • lib-jitsi-meet v1699.0.0+683dc0fb
  • docker-jitsi-meet stable-8960
  • Clients on Chrome 117
@saghul
Copy link
Member

saghul commented Oct 10, 2023

We should probably call the all the pending task callbacks when killing an AsyncQueue, with a specific error that replaceTrack would catch. It would then resolve its promise (it seems ok not to manage to replace a track on a non-existing peer connection).

This sounds about right!

athouary pushed a commit to athouary/lib-jitsi-meet that referenced this issue Oct 11, 2023
…itsi#2370)

This ensures that promises relying on the task callback will settle.
athouary pushed a commit to athouary/lib-jitsi-meet that referenced this issue Oct 11, 2023
This ensures that promises relying on the task callback will settle.
athouary pushed a commit to athouary/lib-jitsi-meet that referenced this issue Oct 12, 2023
athouary pushed a commit to athouary/lib-jitsi-meet that referenced this issue Oct 16, 2023
athouary pushed a commit to athouary/lib-jitsi-meet that referenced this issue Oct 16, 2023
athouary added a commit to athouary/lib-jitsi-meet that referenced this issue Dec 5, 2023
athouary added a commit to athouary/lib-jitsi-meet that referenced this issue Dec 6, 2023
athouary added a commit to athouary/lib-jitsi-meet that referenced this issue Dec 6, 2023
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this issue Jul 19, 2024
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this issue Jul 19, 2024
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this issue Jul 19, 2024
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this issue Jul 19, 2024
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this issue Jul 19, 2024
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this issue Jul 19, 2024
subhamcyara pushed a commit to subhamcyara/lib-jitsi-meet that referenced this issue Jul 19, 2024
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

No branches or pull requests

2 participants