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

Messages sent on staging web are only appearing after navigate away from the report and run OpenReport again #51132

Closed
1 of 8 tasks
m-natarajan opened this issue Oct 19, 2024 · 33 comments
Assignees
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Needs Reproduction Reproducible steps needed

Comments

@m-natarajan
Copy link

m-natarajan commented Oct 19, 2024

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:
Reproducible in staging?: Needs Reproduction
Reproducible in production?: Needs Reproduction
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @muttmuure
Slack conversation: https://expensify.slack.com/archives/C05LX9D6E07/p1729266448987419

Action Performed:

  1. Log in to web and native app with same account as user A
  2. Send messages to User A from user B

Expected Result:

Messages delivered to both the devices at the same time

Actual Result:

Not receiving messages in web on real time but getting push notifications for the same in app. Messages sent on staging web are only appearing after navigate away from the report and run OpenReport again

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
{
    "chatType": "group",
    "currency": "USD",
    "description": "",
    "errorFields": {},
    "hasOutstandingChildRequest": false,
    "hasOutstandingChildTask": false,
    "isCancelledIOU": false,
    "isOwnPolicyExpenseChat": false,
    "isPinned": true,
    "isWaitingOnBankAccount": false,
    "lastActionType": "ADDCOMMENT",
    "lastActorAccountID": 6851710,
    "lastMentionedTime": "2024-10-16 15:23:27.935",
    "lastMessageHtml": "that's so weird",
    "lastMessageText": "could you ping me on Slack if you've replied already? I'll copy the onyx data f…",
    "lastReadSequenceNumber": 0,
    "lastReadTime": "2024-10-18 15:24:29.471",
    "lastVisibleActionCreated": "2024-10-18 15:24:29.471",
    "lastVisibleActionLastModified": "2024-10-18 15:23:06.471",
    "nonReimbursableTotal": 0,
    "notificationPreference": "always",
    "oldPolicyName": "",
    "ownerAccountID": 0,
    "participants": {
        "778531": {
            "hidden": false,
            "notificationPreference": "always",
            "role": "member"
        },
        "2697693": {
            "hidden": false,
            "notificationPreference": "always",
            "role": "member"
        },
        "6851710": {
            "hidden": false,
            "notificationPreference": "always",
            "role": "member"
        },
        "10160771": {
            "hidden": false,
            "notificationPreference": "always",
            "role": "admin"
        }
    },
    "permissions": [
        "read",
        "write",
        "share"
    ],
    "policyID": "_FAKE_",
    "private_isArchived": "",
    "reportID": "4160486413986541",
    "reportName": "NewDot Quality Curation",
    "stateNum": 0,
    "statusNum": 0,
    "total": 0,
    "type": "chat",
    "unheldTotal": 0,
    "welcomeMessage": "",
    "writeCapability": "all",
    "lastMessageTranslationKey": "",
    "state": "OPEN",
    "unheldNonReimbursableTotal": 0
}

logs-2024-10-18 15_34_39.778.txt

View all open jobs on GitHub

@m-natarajan m-natarajan added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. AutoAssignerNewDotQuality Used to assign quality issues to engineers labels Oct 19, 2024
Copy link

melvin-bot bot commented Oct 19, 2024

Triggered auto assignment to @justinpersaud (AutoAssignerNewDotQuality)

Copy link

melvin-bot bot commented Oct 19, 2024

Triggered auto assignment to @zanyrenney (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@melvin-bot melvin-bot bot added the Weekly KSv2 label Oct 19, 2024
@melvin-bot melvin-bot bot removed the Weekly KSv2 label Oct 19, 2024
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@justinpersaud
Copy link
Contributor

Is this still happening? I am not able to reproduce

@justinpersaud
Copy link
Contributor

Ok seems like I sort of was able to reproduce this.

I left staging web open in the background for a few hours. I then went back to the tab and saw no new messages were posted in #social.

However, I didn't do anything else and eventually it just updated everything at once.

@muttmuure
Copy link
Contributor

Yes it was happening to me this morning. I wasn't receiving updates until I navigated back to the report

@muttmuure
Copy link
Contributor

It's going to be tough to establish reproduction steps if you can't do it straight away, I thought it was an obvious regression but perhaps not

@zanyrenney
Copy link
Contributor

Matt - do you mind taking this one if you're experiencing it? I can't access staging at all so it's not possible for me to test this? https://expensify.slack.com/archives/C049HHMV9SM/p1729158805892819

cc @muttmuure

@muttmuure
Copy link
Contributor

I think for this one, we need to trace the logs at the time, and understand if pusher was disconnected

@muttmuure muttmuure moved this to MEDIUM in [#whatsnext] #quality Oct 23, 2024
@zanyrenney
Copy link
Contributor

@zanyrenney
Copy link
Contributor

bump @muttmuure

@muttmuure
Copy link
Contributor

So to narrow this down, I think we should look for:

  • The time stamps around when I was reporting this.
  • The instances where pusher failed

@zanyrenney
Copy link
Contributor

Cool, Matt - cheers!

@justinpersaud do those Logs help you to push this forward? I don't think there is more the BZ can do here now Matt has got that log search.

Thanks in advance!

@justinpersaud
Copy link
Contributor

In the logs Matt provided I see this

[App] 2024-10-18T15:31:44.995Z - [alXt] Unhandled Promise Rejection: Failed to write blobs (InvalidBlob)#012Stack: undefined ~~ userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'

Searching for that error, it seems this is not the first time we've seen similar issues

#45356

I bumped the old thread https://expensify.slack.com/archives/C05LX9D6E07/p1730292728785699?thread_ts=1721217121.843389&cid=C05LX9D6E07

@justinpersaud
Copy link
Contributor

@chrispader I see you in the blame here for this https://github.com/Expensify/react-native-onyx/blob/main/lib/Onyx.ts#L274-L298

I think that is where the error above is coming from. Do you happen to have any ideas here?

@justinpersaud
Copy link
Contributor

I'm going to be OOO next week but @chrispader said he would look into this later today.

Copy link

melvin-bot bot commented Nov 2, 2024

@justinpersaud @zanyrenney this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Nov 4, 2024
@zanyrenney
Copy link
Contributor

hey @chrispader any update on this one, please?

@melvin-bot melvin-bot bot removed the Overdue label Nov 4, 2024
@zanyrenney
Copy link
Contributor

2024-11-04_18-05-48

Unfortunately i'm not able to assign you.

@zanyrenney
Copy link
Contributor

Copy link

melvin-bot bot commented Nov 4, 2024

@justinpersaud, @zanyrenney Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@chrispader
Copy link
Contributor

Sorry for the delay. I'm looking into it later today!

@chrispader
Copy link
Contributor

chrispader commented Nov 6, 2024

@chrispader I see you in the blame here for this Expensify/react-native-onyx@main/lib/Onyx.ts#L274-L298

The highlighted code in react-native-onyx is at a very low-level in the Onyx.merge function. This code basically just handles null values passed as the merge delta, logs info about the merge and handles different merge approaches for web (IndexedDB) vs native (SQLite).

I think that is where the error above is coming from. Do you happen to have any ideas here?

Therefore, i don't think this issue is directly caused by this code. We implemented this already a while back and so far, we didn't have any regressions because of this. (@justinpersaud, i know you're OOO so no hurry in answering, but how did you get to exactly this piece of code?)

The main thing we had to migrate from since this change was that null values passed to Onyx.merge/Onyx.setact as a "deleting" instruction to Onyx. We might want to check if any of the E/App report (action) related code handles null values incorrectly.

@chrispader
Copy link
Contributor

I couldn't reproduce this issue myself. I tried the repro steps but always received messages on both native device and (staging) web.

Also i think the repro steps should be improved. E.g. in what state should each of the devices/sessions be? E.g. on the phone, should the app and chat be opened or not? Afaik, the user doesn't receive notifications when the app is in foreground.

On web, should the affected report be focussed or not?

@chrispader
Copy link
Contributor

@zanyrenney i can ofc continue investigating this issue if you want, but i'm not sure if someone else is supposed to fix this. I'd probably need some more repro steps in order to actually see this issue :)

@zanyrenney
Copy link
Contributor

We’re waiting until @justinpersaud returns because he identified Chris in the blame, but Chris isn’t clear on why or how. If we want Chris to investigate, we can, but it would be helpful to get the missing context from Justin!

@melvin-bot melvin-bot bot added the Overdue label Nov 11, 2024
@zanyrenney
Copy link
Contributor

Hey @justinpersaud - I think you're back from OOO now. Mind reviewing this and clarifying for us, please? Thanks!

@melvin-bot melvin-bot bot removed the Overdue label Nov 11, 2024
@justinpersaud
Copy link
Contributor

@chrispader I got there from the logs @muttmuure provided above. Here they are since you can't see them

[App] PID ~~ 2184342
[App] Processing 'Log' for 'expensify.com' from '104.28.160.249' ~~ command: 'Log' api_setCookie: 'false' expensifyCashAppVersion: 'expensifyCash[web]9.0.50-8' appversion: '9.0.50-8' referer: 'ecash' platform: 'web' email: '[email protected]' isFromDevEnv: 'false' clientUpdateID: '2472469029' partnerName: 'expensify.com' browserGUID: '67127f61d7e2b' HTTP_CF_BOT_SCORE: '99' HTTP_CF_JA3_HASH: '550518ce2834286070c227fa8bc8c9d9'
[App] 2024-10-18T15:26:30.647Z - [info] Previous log requestID ~~ requestID: '8d498c107bfd93f3-LHR' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:26:30.647Z - [info] [OnyxUpdateManager] Applying update type: https with lastUpdateID: 0 ~~ command: 'Log' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:27:17.815Z - [info] [Onyx] set called for key: activeClients properties: 0,1,2,3,4,5 hasChanged: false ~~ parameters: '' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:31:39.557Z - [info] [Onyx] merge called for key: reportUserIsTyping_4160486413986541 properties: 778531 hasChanged: true ~~ parameters: '' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:31:40.783Z - [info] [Onyx] merge called for key: reportUserIsTyping_4160486413986541 properties: 778531 hasChanged: false ~~ parameters: '' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:31:42.286Z - [info] [Onyx] merge called for key: reportUserIsTyping_4160486413986541 properties: 778531 hasChanged: true ~~ parameters: '' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:31:44.993Z - [info] [Report] Handled multipleEvents event sent by Pusher ~~ updates: '[0: '[data: '[0: '[key: 'report_4160486413986541' onyxMethod: 'merge' value: '[participants: '[778531: '[hidden: '' notificationPreference: 'always' role: 'member']' 2697693: '[hidden: '' notificationPreference: 'always' role: 'member']' 6851710: '[hidden: '' notificationPreference: 'always' role: 'member']' 10160771: '[hidden: '' notificationPreference: 'always' role: 'admin']']']']' 1: '[key: 'report_4160486413986541' onyxMethod: 'merge' value: '[chatType: 'group' description: '' lastActorAccountID: '778531' lastMessageText: '<REDACTED>' lastVisibleActionCreated: '2024-10-18 15:31:40.375' managerID: '' ownerAccountID: '0' parentReportActionID: '' parentReportID: '' policyID: '_FAKE_' reportID: '4160486413986541' reportName: 'NewDot Quality Curation' state: 'OPEN' stateNum: '0' statusNum: '0' type: 'chat' visibility: '']']' 2: '[key: 'reportActions_4160486413986541' onyxMethod: 'merge' shouldShowPushNotification: '1' value: '[3075963487890658293: '[actionName: 'ADDCOMMENT' actorAccountID: '778531' avatar: 'https://d1wpcgnaa73g0y.cloudfront.net/36e397299365c36a787b6084a641bd2fe1b28a58_128.jpeg' created: '2024-10-18 15:31:40.375' lastModified: '2024-10-18 15:31:40.375' message: '[0: '[html: '<REDACTED>' text: '<REDACTED>' type: 'COMMENT' whisperedTo: '[]']']' originalMessage: '[html: '<REDACTED>' isNewDot: '1' lastModified: '2024-10-18 15:31:40.375']' person: '[0: '[style: 'strong' text: '<REDACTED>' type: 'TEXT']']' reportActionID: '3075963487890658293' shouldShow: '1']']']' 3: '[key: 'personalDetailsList' onyxMethod: 'merge' value: '[778531: '[accountID: '778531' avatar: 'https://d1wpcgnaa73g0y.cloudfront.net/36e397299365c36a787b6084a641bd2fe1b28a58_128.jpeg' displayName: 'Puneet Lath' firstName: 'Puneet' lastName: 'Lath' login: '[email protected]' phoneNumber: '' pronouns: '__predefined_heHimHis' status: '' timezone: '[automatic: '1' selected: 'America/New_York']' validated: '1']']']']' eventType: 'onyxApiUpdate']']' lastUpdateID: '2472469029' previousUpdateID: '2472339842' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:31:44.993Z - [info] [OnyxUpdateManager] Applying update type: pusher with lastUpdateID: 2472469029 ~~ userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:31:44.994Z - [info] [Onyx] merge called for key: OnyxUpdatesLastUpdateIDAppliedToClient hasChanged: true ~~ parameters: '' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] 2024-10-18T15:31:44.995Z - [alXt] Unhandled Promise Rejection: Failed to write blobs (InvalidBlob)#012Stack: undefined ~~ userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] ~~ userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
[App] StoreUtils - Clearing all the stores.
[App] TransactionStore cache fully cleared
[App] ReportStore cache cleared
[App] NVPStore - clear cache
[App] NVPStore - clear cache
[App] SharedInNVPStore - clear cache
[App] ReportDuplicatedTransactionsStore - Cache cleared
bench] [[App] Bench totals for command Log ~~ {"total":0}
[App] Profile ~~ {"total":9,"cmd":"Log","jsonCode":200,"output":{"size":71,"gzip":1,"ratio":139},"gzip":71,"PHP":{"total":9,"%":100,"boot":5,"proc":4,"pack":0,"mem":2}}
[App] Timing: cmd= Log totalTime= 9 authTotalTime= authRunTime= 0

I see that it was doing an onyx merge right before, so that is where I found that code.

@chrispader
Copy link
Contributor

chrispader commented Nov 12, 2024

@chrispader I got there from the logs @muttmuure provided above. Here they are since you can't see them

Hmm, so based on the logs i don't think this is an issue with the logic in Onyx.merge itself.

I happen to have also worked on the OnyxUpdateManager logic, which is in charge of handling missing Onyx updates. Based on the onyx key OnyxUpdatesLastUpdateIDAppliedToClient we keep track of missing updates, that haven't been received from the backend and that are therefore fetched manually with the GetMissingOnyxUpdates query.

[App] 2024-10-18T15:31:44.994Z - [info] [Onyx] merge called for key: OnyxUpdatesLastUpdateIDAppliedToClient hasChanged: true ~~ parameters: '' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'

The merge executed on this key effectively just changes a number value. Therefore i don't think the following error ("Failed to write blobx") stems from this merge:

[App] 2024-10-18T15:31:44.995Z - [alXt] Unhandled Promise Rejection: Failed to write blobs (InvalidBlob)#012Stack: undefined

The last Onyx.merge log must not necessarily be causing this issue. Most likely it is actually caused by some Onyx operation, but i think the problem is more about the actual content/value that we're trying to set

Since this issue is occurring on web, this is most likely caused by either IndexedDB or some other library. I did some research and found e.g. this thread: https://issues.chromium.org/issues/40728654

(This might be related to storage being almost full.)

@chrispader
Copy link
Contributor

As said before, i can start investigating this issue if you guys want, but i couldn't reproduce it the last time i tested, so any further repro steps and maybe more (detailed) logs would be very much appreciated! 🙌

@justinpersaud
Copy link
Contributor

I have been trying to reproduce but no luck here.

@justinpersaud
Copy link
Contributor

We're going to close this off due to lack of reliable reproduction steps. Can revisit it again in the future if we see it https://expensify.slack.com/archives/C05LX9D6E07/p1731510575229519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoAssignerNewDotQuality Used to assign quality issues to engineers Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Needs Reproduction Reproducible steps needed
Projects
Development

No branches or pull requests

6 participants