Skip to content

fix(ear): messages can't be displayed - WPB-24136 🍒#4477

Open
github-actions[bot] wants to merge 2 commits intodevelopfrom
fix/sync-cancellation-issues-cherry-pick-cherry-pick
Open

fix(ear): messages can't be displayed - WPB-24136 🍒#4477
github-actions[bot] wants to merge 2 commits intodevelopfrom
fix/sync-cancellation-issues-cherry-pick-cherry-pick

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Mar 24, 2026

BugWPB-24136 [iOS] Messages can't be displayed due to decryption errors

This PR was automatically cherry-picked based on the following PR:

Original PR description:


This PR was automatically cherry-picked based on the following PR:

Original PR description:


Issue

Sometimes, with EAR enabled, after opening the app, some messages can't be displayed.

Screenshot 2026-03-18 at 11 53 24

Cause

Messages couldn't be encrypted at rest because the database key was missing.

This happens because the app went to the background and locked the database (nullified the database key from cache) while the incremental sync was running and processing messages.

When this happens, we cancel the sync

However, the cancellation doesn't get propagated properly from the suspend method to the inner sync task. Hence, the sync continues and tries to process messages while the database key is nil

Solution

  • Propagate task cancellation properly in NonReentrantTaskManager and ExpiringActivity
  • Add a Task.checkCancellation before processing individual events in the incremental sync
  • Add a guard against having the database locked before processing any non-backgroundAccessible event, and handle cleaning up the processed events from the current batch

Testing

  1. Log in & Enable EAR
  2. Put the app in the background
  3. Receive many messages (use a spambot to send 100s of messages)
  4. Open the app and immediately put it in the background once the sync starts
  5. Reopen the app

Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

Co-authored-by: David-Henner <david.henner@wire.com>
Co-authored-by: KaterinaWire <57407805+KaterinaWire@users.noreply.github.com>
Co-authored-by: François Benaiteau <netbe@users.noreply.github.com>
@netbe netbe changed the title fix(ear): messages can't be displayed - WPB-24136 🍒 🍒 fix(ear): messages can't be displayed - WPB-24136 🍒 Mar 24, 2026
Copy link
Copy Markdown
Collaborator

@netbe netbe left a comment

Choose a reason for hiding this comment

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

🍒

Copy link
Copy Markdown
Collaborator

@zenkins zenkins left a comment

Choose a reason for hiding this comment

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

✅ Auto-approved cherry-pick PR 🍒.

@netbe netbe enabled auto-merge March 24, 2026 14:44
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
12.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Mar 26, 2026

Test Results

    4 files    519 suites   5m 46s ⏱️
4 047 tests 4 044 ✅ 3 💤 0 ❌
4 048 runs  4 045 ✅ 3 💤 0 ❌

Results for commit 1bee65b.

Summary: workflow run #23598716909
Allure report (download zip): html-report-28834-fix_sync-cancellation-issues-cherry-pick-cherry-pick

@netbe netbe added this pull request to the merge queue Mar 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants