-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[$250] Chat - Group is created with duplicate user when chat is started quickly on a slow network #49931
Comments
Triggered auto assignment to @RachCHopkins ( |
Please clarify the "actual result" |
Waiting on a response/clarification from QA team. |
team is still able to reproduce group.chat.mp4 |
Ok, to sum up, it can be reproduced and we don't know what/who the third user is. |
Job added to Upwork: https://www.upwork.com/jobs/~021843049310841478139 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat ( |
Edited by proposal-police: This proposal was edited at 2024-10-07T12:12:00Z. ProposalPlease re-state the problem that we are trying to solve in this issue.After sending the message, the chat turns into a group with duplicate users. It only corrects itself back to a single chat after switching to another chat and then returning to it What is the root cause of that problem?When App/src/libs/actions/QueuedOnyxUpdates.ts Lines 11 to 15 in 04214cd
We've had the logic to flush the queue after all requests are complete here App/src/libs/Network/SequentialQueue.ts Lines 172 to 174 in 04214cd
But in this case after App/src/libs/actions/OnyxUpdates.ts Lines 147 to 153 in 04214cd
After What changes do you think we should make in order to solve the problem?
App/src/libs/Network/SequentialQueue.ts Line 192 in 04214cd
What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.On slow networks, if we create a report and comment on it, a group with a duplicate chat is created. What is the root cause of that problem?For write requests, we do not write the response onyxData and the corresponding successData/failureData/finallyData to Onyx directly. Instead, we write them to queuedOnyxUpdates to prevent the replay effect. App/src/libs/actions/OnyxUpdates.ts Lines 30 to 32 in 78e484f
These updates are flushed only after all the PersistedRequests are cleared. App/src/libs/Network/SequentialQueue.ts Lines 173 to 175 in 78e484f
We remove a request from persistent requests only after the response is received and processed with all middlewares. App/src/libs/Network/SequentialQueue.ts Lines 90 to 99 in 78e484f
So, on slow networks, when we call OpenReport, its response and corresponding request’s successData, etc., are added to queuedOnyxUpdates. This cannot be flushed immediately because there was already an AddComment request added to the PersistedRequests. For some reason that needs to be fixed, the backend sends a previousUpdateID for AddComment that is larger than the previous lastUpdateID/lastClientUpdateID. This makes doesClientNeedToBeUpdated true.
As a result, the AddComment response is not processed directly with OnyxUpdates.apply. It sets this AddComment response to saveUpdateInformation, and the queue is paused. When the queue is paused, the updates waiting in queuedUpdates are not flushed, so OpenReport’s successData waits in the queuedUpdates, and the optimistic user detail is not removed, making the report appear like a group report. What changes do you think we should make in order to solve the problem?
DeferredOnyxUpdates.getMissingOnyxUpdatesQueryPromise()?.finally(finalizeUpdatesAndResumeQueue).then(() => QueuedOnyxUpdates.flushQueue()); What alternative solutions did you explore? (Optional) |
@parasharrajat, @RachCHopkins Whoops! This issue is 2 days overdue. Let's get this updated quick! |
@parasharrajat do you like any of the proposals here? |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@RachCHopkins I won't be available from 16 Oct for a few days, please reassign. |
I can take over this issue as C+ |
@parasharrajat @RachCHopkins this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
That is fine. It is necessary for PersistedRequests to be empty before flushing the queue. While I explained it in the next |
hmm, thanks @c3024 for that detailed explanation: #49931 (comment) I gave it a first read, I didn't understand 100% because I'm not very familiar with all that, but I think I understood that there is a backend bug related to the onyx updates ids being passed around. If this is true, I'd prefer to prioritize and fix that first, and then see again where we are at with this bug. I'll give it sometime later today to try to reproduce your detailed steps and see if I can understand/see the bug. |
@RachCHopkins, @aldo-expensify, @DylanDylann Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
I fail that day and then I forgot to come back. I'll try to take a better look at this asap |
not overdue, waiting for @aldo-expensify |
@RachCHopkins @aldo-expensify @DylanDylann this issue is now 4 weeks old, please consider:
Thanks! |
Sorry, still haven't had time for this yet. |
Waiting on Aldo. Not overdue. |
Hmm... I think the |
Changing this behaviour in the backend sounds tricky to do. We forward the command to avoid making |
Assigning @nkdengineer since the proposal to fix the frontend makes sense to me too. |
📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
@aldo-expensify, Could you help to check this comment? I believe that we need to get the PR merged as soon as possible because there are many similar bugs in other places that also be fixed by our PR
|
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results. If a regression has occurred and you are the assigned CM follow the instructions here. If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future. |
@RachCHopkins I'll be off next week (for the whole week). I don't think this bug is very important, so I think it would be fine to wait until after that. If we don't want to wait, feel free to reassign to another engineer. The PR #51712 is a bit tricky to review because it is changing some low level behaviour, and I'm not sure if it may cause more harm than good. Someone with more knowledge about the network queue may know better. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.41-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
The chat with the selected user should remain a 1-on-1 chat. The chat should not change into a group with duplicate users
Actual Result:
After sending the message, the chat turns into a group with duplicate users. It only corrects itself back to a single chat after switching to another chat and then returning to it
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6619285_1727614560806.1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @nkdengineerThe text was updated successfully, but these errors were encountered: