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

Fixes crash when accepting VOIP calls #5909

Merged
merged 1 commit into from
May 4, 2022

Conversation

ouchadam
Copy link
Contributor

@ouchadam ouchadam commented May 3, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Fixes a crash when receiving and consuming call events #5421 (tentatively fixes #5591 and possibly other VOIP quirks)

  • The event insertion logic is designed to be single threaded however due to coroutine continuation, there's unintended multiple thread access when the processing and post processing overlap
  • Fixed by converting the launching to a flow which will sequentially process the launch logic on the single threaded scope

Motivation and context

To fix a VOIP crash

Screenshots / GIFs

  • Adds a small delay to the postProcessing step
  • Send 5 messages

Before

  • Notice multiple concurrent launches
Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND

Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND

Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND

Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND

Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND

After

  • Notice sequential launches, each waiting for the post processing to complete
Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND

Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND

Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND

Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND

Launch: LIVE_ENTITY_BACKGROUND
Process start: pool-7-thread-1
Process end: LIVE_ENTITY_BACKGROUND
Post start: LIVE_ENTITY_BACKGROUND
Post end: LIVE_ENTITY_BACKGROUND

Tests

  • Add a manual delay in the code to the call post processing
  • Spam call invites
  • Notice a crash

Tested devices

  • Physical
  • Emulator
  • OS version(s): 28

- the event insert logic is designed to be single threaded however the scope will allow coroutine continuation which leads to unintended multiple thread access for processing and post processing
- the fix is to convert the launching to a flow which will sequentially process the launch logic on the single threaded scope
@github-actions
Copy link

github-actions bot commented May 3, 2022

Unit Test Results

122 files  ±0  122 suites  ±0   2m 4s ⏱️ -2s
205 tests ±0  205 ✔️ ±0  0 💤 ±0  0 ±0 
690 runs  ±0  690 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit c09a93c. ± Comparison against base commit 0325754.

@ouchadam ouchadam requested review from ganfra, a team and bmarty and removed request for a team May 3, 2022 12:10
@ouchadam ouchadam added the PR-Small PR with less than 20 updated lines label May 3, 2022
Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@ouchadam ouchadam merged commit 1d59f69 into develop May 4, 2022
@ouchadam ouchadam deleted the defect/adm/crash-when-processing-call-events branch May 4, 2022 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Small PR with less than 20 updated lines Z-Crash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calls unable to be used.
3 participants