Skip to content

fix: messages not being sent, waiting forever for decryption to finish - WPB-17866 #3074

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

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented May 26, 2025

BugWPB-17866 [iOS] Not able to send messages on mobile data

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

Original PR description:


Issue

Context: Messages are stuck forever in a sending state, no way to recover. Next messages can't be sent as well, stuck in same state.

We introduced in this PR a mechanism that waits for pending events to be decrypted before proceeding to message sending.

Specifically in MessageSender, we await for incrementalSyncObserver.waitUntilCanSendMessage() and it only gets through when finishing decrypting the pending events and setting the decryptionState to done at the IncrementalSyncObserver level.

Causes: The decryption state might never gets updated to .done hence blocking the message sender to proceed the message which can lead to the bugs mentioned here and here.

What happens after is that if we try to send a message again we'll be stuck in a loop in try await messageDependencyResolver.waitForDependenciesToResolve(for: message) where the dependencies never resolve specifically dependentObjectNeedingUpdateBeforeProcessing (code doc below) will never be nil, probably because the initial message was never really processed and it blocks the next messages.

/// Other entities which has to complete an update before this entity can be processed, i.e. another message /// needs to be sent first because it was scheduled for sending before this message.

Solution: Update the sync state whenever the sync is suspended or when an error occurs while pulling (and decrypting) pending events so we ensure the decryption state is changed to done so the MessageSender method is "unlocked" and the messages are sent or at least attempted to be sent.

Testing

Tested internally

  • Comment out the code where the sync state is updated so the MessageSender gets stuck and the message not sent.
  • try to send message again and again
  • messages shows up as in sending state just like the screenshots from the Jira tickets

Capture d’écran   2025-05-23 à 16 47 36

Checklist

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

UI accessibility checklist

If your PR includes UI changes, please utilize this checklist:

  • Make sure you use the API for UI elements that support large fonts.
  • All colors are taken from WireDesign.ColorTheme or constructed using WireDesign.BaseColorPalette.
  • New UI elements have Accessibility strings for VoiceOver.

@caldrian caldrian changed the base branch from develop to release/cycle-3.125 May 27, 2025 07:45
@caldrian caldrian force-pushed the fix/messages-not-being-sent-cherry-pick branch from 076bc7b to b1d932f Compare May 27, 2025 07:47
Copy link
Contributor Author

Test Results

3 538 tests   3 512 ✅  4m 25s ⏱️
  564 suites     26 💤
    4 files        0 ❌

Results for commit b1d932f.

@datadog-wireapp
Copy link

Datadog Report

Branch report: fix/messages-not-being-sent-cherry-pick
Commit report: f235427
Test service: wire-ios-mono

✅ 0 Failed, 3512 Passed, 26 Skipped, 2m 14.66s Total Time

@caldrian caldrian changed the base branch from release/cycle-3.125 to fix/messages-not-being-sent-cherry-pick.tmp May 27, 2025 08:19
@caldrian caldrian changed the base branch from fix/messages-not-being-sent-cherry-pick.tmp to release/cycle-3.125 May 27, 2025 08:19
@caldrian caldrian changed the title fix: messages not being sent, waiting forever for decryption to finish - WPB-17866 fix: messages not being sent, waiting forever for decryption to finish - WPB-17866 May 27, 2025
@caldrian caldrian changed the title fix: messages not being sent, waiting forever for decryption to finish - WPB-17866 fix: messages not being sent, waiting forever for decryption to finish - WPB-17866 May 27, 2025
@jullianm jullianm merged commit bfad07f into release/cycle-3.125 May 27, 2025
18 of 20 checks passed
@jullianm jullianm deleted the fix/messages-not-being-sent-cherry-pick branch May 27, 2025 08:27
zenkins pushed a commit that referenced this pull request May 27, 2025
…h - WPB-17866 (#3074)

Co-authored-by: Jullian Mercier <31648126+jullianm@users.noreply.github.com>
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.

2 participants