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

Avoid race condition on asynchronous update tasks #1841

Merged
merged 2 commits into from
Dec 2, 2021
Merged

Conversation

hensmi-amazon
Copy link
Contributor

Issue #: #1448 & #1805

Description of changes: #1448 explains issue (see my comment at bottom). This change simply defers ingestion of index/resubscribe check until after the update completes.

Testing: With the pagination demo I can repro this occaisonally if I join a meeting with 3 videos, and 2 per page, local backend. The resubscribe spam in beginning of call seem to lead to one video being missing. I don't see the issue after change. Its also trivial to inspect logs to verify this works as expected.

Can these tested using a demo application? Please provide reproducible step-by-step instructions.
Not really, without looking at logs and trying to spam resubscribes.

Checklist:

  1. Have you successfully run npm run build:release locally?
    y

  2. Do you add, modify, or delete public API definitions? If yes, has that been reviewed and approved?
    n

  3. Do you change the wire protocol, e.g. the request method? If yes, has that been reviewed and approved?
    n

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

// need this protection because they are synchronous.
this.monitorTask.pauseResubscribeCheck();
this.receiveIndexTask.pauseIngestion();

Copy link
Contributor

Choose a reason for hiding this comment

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

race condition can still happen in other task like ReceiveVideoInputTask right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With integrateUplinkPolicyDecision ? I'm not too concerned about that impact since we are mostly relying on avg bitrate anyways.

Copy link
Contributor

@ltrung ltrung Dec 1, 2021

Choose a reason for hiding this comment

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

No, it can cause video to fail when calling choose video input multiple when the video is on (https://github.com/aws/amazon-chime-sdk-js/blob/master/src/task/ReceiveVideoInputTask.ts#L32). See this issue #1609 . It is exactly related to this issue you are fixing but it is another race condition in update.

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