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

fix: prevent cancellation midway through event processing [WPB-7070] #2952

Merged

Conversation

vitorhugods
Copy link
Member

@vitorhugods vitorhugods commented Aug 15, 2024

BugWPB-7070 [Android] Missing message on flaky internet


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

It's possible to have event processing being cancelled midway through and we would still mark them as processed.

Causes

Although unlikely, if we cancel the event processing midway through due to connectivity changing or websocket closing, we may swallow cancellation exceptions in wrapStorageRequest, and we do not return success/failure to the EventProcessor itself, as it expects exceptions to be thrown.

Solutions

The idea is to completely forbid cancellation midway through event processing, by:

  1. Using the UserSessionScope as the CoroutineScope for event processing. Making it so it will only be cancelled when the user logs out.
  2. Wrap the actual event processing with withContext(NonCancellable) {}

Testing

Test Coverage

  • I have added automated test to this contribution

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@vitorhugods vitorhugods requested review from MohamadJaara, a team, alexandreferris, Garzas, ohassine and saleniuk and removed request for a team August 15, 2024 12:49
@echoes-hq echoes-hq bot added the echoes: unplanned Any work item that isn’t part of the product or technical roadmap. label Aug 15, 2024
Copy link
Contributor

github-actions bot commented Aug 15, 2024

Test Results

3 171 tests  +146   3 066 ✔️ +59   3m 20s ⏱️ - 2m 3s
   543 suites +536      105 💤 +87 
   543 files   +536          0 ±  0 

Results for commit 216237a. ± Comparison against base commit faff60a.

♻️ This comment has been updated with latest results.

Copy link

@datadog-wireapp
Copy link

datadog-wireapp bot commented Aug 15, 2024

Datadog Report

Branch report: fix/prevent-missing-messages-on-flaky-internet
Commit report: 9417151
Test service: kalium-jvm

✅ 0 Failed, 3066 Passed, 105 Skipped, 10.3s Total Time

@MohamadJaara MohamadJaara added this pull request to the merge queue Aug 16, 2024
Merged via the queue into release/candidate with commit e52dc1d Aug 16, 2024
22 checks passed
@MohamadJaara MohamadJaara deleted the fix/prevent-missing-messages-on-flaky-internet branch August 16, 2024 10:30
github-merge-queue bot pushed a commit that referenced this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: unplanned Any work item that isn’t part of the product or technical roadmap. 🚨 Potential breaking changes 👕 size: M type: bug / fix 🐞
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants