-
Notifications
You must be signed in to change notification settings - Fork 6
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: mls 1on1 race condition [WPB-15395] #3237
Conversation
question: in this case do we need it to wait, imo just returning without doing anything is enough since the slow sync will migrate this 1:1 anyway |
Datadog ReportBranch report: ✅ 0 Failed, 3239 Passed, 108 Skipped, 1m 1.45s Total Time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just would be great to add tags to the logs
...monMain/kotlin/com/wire/kalium/logic/data/conversation/JoinExistingMLSConversationUseCase.kt
Outdated
Show resolved
Hide resolved
...c/src/commonMain/kotlin/com/wire/kalium/logic/data/conversation/MLSConversationRepository.kt
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/candidate #3237 +/- ##
==================================================
Coverage 54.52% 54.52%
==================================================
Files 1250 1250
Lines 36524 36554 +30
Branches 3696 3698 +2
==================================================
+ Hits 19913 19932 +19
- Misses 15213 15222 +9
- Partials 1398 1400 +2
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
@@ -454,7 +456,15 @@ internal class MLSConversationDataSource( | |||
retryOnStaleMessage = true, | |||
allowPartialMemberList = false, | |||
cipherSuite = cipherSuite | |||
).map { Unit } | |||
).onFailure { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isnt' this code path also called when adding users to an existing conversation? We certainly don't want wipe any conversation then. We only want to do when we fail to establish the initial MLS group.
resolveConversationIfOneOnOne(event.conversationId) | ||
} | ||
.flatMapLeft { | ||
if (it is MLSFailure.ConversationAlreadyExists) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add warning here then? "Discarding welcome since the conversation already exists "
Quality Gate passedIssues Measures |
* fix: race condition during 1on1 mls creation, more logs * scope init fix * test fix * added ignore on welcome message when conv already exist, reverted wipe on member join * added warning
* fix: race condition during 1on1 mls creation, more logs * scope init fix * test fix * added ignore on welcome message when conv already exist, reverted wipe on member join * added warning Co-authored-by: Jakub Żerko <[email protected]>
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What’s New in This PR?
This PR addresses a race condition during 1:1 MLS conversation creation and improves logging throughout the MLS-related codebase.
Issues
ConversationAlreadyExists
Cannot execute operation because a pending commit exists
Causes
NotifyConversationIsOpenUseCase
), which also tries to resolve or establish a 1:1 MLS group.Solutions
Waiting for Slow Sync
NotifyConversationIsOpenUseCaseImpl
, we now explicitly wait forSlowSyncStatus
to reachComplete
before reevaluating the protocol for a 1:1 conversation.Improved Logging
kaliumLogger.d(...)
) inJoinExistingMLSConversationUseCase
,MLSConversationDataSource
, andNotifyConversationIsOpenUseCaseImpl
.Failure Handling (Wipe on Add Member Failure)
MLSConversationDataSource
, if adding members to an MLS group fails, we attempt a conversation wipe.