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

[HOLD for payment 2023-02-07] [$1000] Web - Log out - Console error is displayed when log out #14350

Closed
1 task done
kbecciv opened this issue Jan 17, 2023 · 62 comments
Closed
1 task done
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jan 17, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to staging.new.expensify.com
  2. Log in with expensifail account
  3. Go to Setting - Sign out

Expected Result:

Console error is not displayed when log out

Actual Result:

Console error is displayed when log out

Workaround:

Unknown

Platforms:

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

  • Web / Chrome / Safari

Version Number: 1.2.55.0

Reproducible in staging?: Yes

Reproducible in production?: No

If this was caught during regression testing, add the test name, ID and link from TestRail:

Email or phone of affected tester (no customers): applausetester+0901abb@applause.expensifail.com/Feya87Katya

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Recording.2010.mp4

6
7
8
9

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015d869c70481d179b
  • Upwork Job ID: 1617488772668575744
  • Last Price Increase: 2023-01-23
@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Jan 17, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Jan 17, 2023
@kbecciv kbecciv added the Hourly KSv2 label Jan 17, 2023
@OSBotify
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@marcaaron
Copy link
Contributor

On first glance this error looks kind of harmless - but also like it is coming from the Pusher JS lib?

Are there any observable bad effects here? Or just a console error?

@marcaaron
Copy link
Contributor

I can reproduce this. Suspect it happens because we have already disconnected from Pusher when we try to unsubscribe from the report channel here:

Report.unsubscribeFromReportChannel(this.props.report.reportID);

The only PR I found related to logging out is here: https://github.com/Expensify/App/pull/13886/files

But not really connecting that change with the Pusher error. Probably will require some debugging.

Not sure if this is a "blocker" though. The error does look a bit harmless - but obviously would be ideal to not see it at all.

I want to say one solution would be to prevent unsubscribing if there is no websocket connection, but not really sure if that's correct to assume. And also doesn't quite explain the root cause of why this error has begun showing up.

@marcaaron
Copy link
Contributor

Update: Only managed to reproduce 1/5 sign outs on staging - so I think most likely this is harmless and should be downgraded to "not blocker" while we continue to investigate - removing the label.

@marcaaron marcaaron added NewFeature Something to build that is a new item. and removed NewFeature Something to build that is a new item. DeployBlockerCash This issue or pull request should block deployment labels Jan 17, 2023
@marcaaron marcaaron removed their assignment Jan 17, 2023
@marcaaron marcaaron added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. and removed Hourly KSv2 labels Jan 17, 2023
@tgolen
Copy link
Contributor

tgolen commented Jan 17, 2023

Yeah, I agree this is not a deploy blocker. Sure strange that this would all of a sudden start happening. I did change how the signout stuff works a little bit but it should mean that the redirect to sign-in page doesn't happen until the Onyx change is committed.

I just reproduced this, and the console logs around the error are sure interesting:

image

I'm not sure what's up with that second error, maybe it's reported in another issue. Seems totally unrelated.

The biggest oddity to me is the log [info] Navigating to route - {"path":"/"} happening twice.

The pusher error is happening from ReportActionsView calling Report.unsubscribeFromReportChannel(this.props.report.reportID); when the component unmounts. So, it's almost like the component is unmounted twice, and therefore we are disconnecting from the report channel twice (one succeeds, the second one fails with that error).

@marcaaron
Copy link
Contributor

Nice debugging.

I don't have much to add but wanted to say that I am not sure if I would 100% trust that log. That can happen anytime the navigation state changes:

return (
<NavigationContainer
fallback={(
<FullScreenLoadingIndicator
logDetail={{name: 'Navigation Fallback Loader', authenticated: props.authenticated}}
style={styles.navigatorFullScreenLoading}
/>
)}
onStateChange={parseAndLogRoute}

Doesn't answer the question of why the NavigationContainer state changes twice - but it might not be because we explicitly navigated to /.

@marcaaron
Copy link
Contributor

Oh I wonder if the Onyx.clear() has something to do with it. Perhaps something about the order in which the subscribers are notified? Maybe we didn't notice this before because of this change:

6def1b3

I'm assuming the Onyx.clear() call unhooks subscribers in a particular order - but in the previous code we would always first log the user out and then clear the rest of the keys. So maybe some of those keys clearing causes a re-render somewhere. Just kinda riffing on that train of thought though - not sure how or why that would cause either of these errors.

@melvin-bot melvin-bot bot added the Overdue label Jan 20, 2023
@dylanexpensify
Copy link
Contributor

Sorry I missed this -reviewing

@melvin-bot melvin-bot bot removed the Overdue label Jan 20, 2023
@dylanexpensify
Copy link
Contributor

Could reproduce the error in staging. @marcaaron @tgolen are we good making this external? Or do we think internal?

@tgolen
Copy link
Contributor

tgolen commented Jan 20, 2023

I think it should go external first 👍

@melvin-bot melvin-bot bot added the Overdue label Jan 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 31, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.62-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-02-07. 🎊

After the hold period, please check if any of the following need payment for this issue, and if so check them off after paying:

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jan 31, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 6, 2023
@Prince-Mendiratta
Copy link
Contributor

Prince-Mendiratta commented Feb 8, 2023

I think this issue is past the regression period now?
Also, there hasn't been any updates in the upstream issue, should we ping them about it?
cc @Santhosh-Sellavel @chiragsalian

@melvin-bot melvin-bot bot added the Overdue label Feb 10, 2023
@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Feb 10, 2023

@chiragsalian I'm not sure what caused this regression, apart from the PR which removed the event name #752 did we break something else?

cc: @Prince-Mendiratta

@melvin-bot melvin-bot bot removed the Overdue label Feb 10, 2023
@Prince-Mendiratta
Copy link
Contributor

Prince-Mendiratta commented Feb 11, 2023

@Santhosh-Sellavel I'll need to view the https://github.com/Expensify/Expensify/issues/144728 issue once.

I think this fix might have broken what was the intentional fix behind #752. I just tried out the mentioned steps in #752 and looks like sending the event name to the unsubscribe function just unbinds that specific event from the channel but does not unsubscribe from the channel itself, the channel connection remains open when we navigate to another channel. Although this won't cause any regression since we do not have any other events subsribed to the report, I'll need to see why the fix was implemented first in https://github.com/Expensify/Expensify/issues/144728.

As for this specific issue, the root cause and solution mentioned in the proposal is correct, we will need to see why this might break and re create https://github.com/Expensify/Expensify/issues/144728 issue.

It's pretty weird though, has this issue been in the repo since 3 years or did it just start popping up?!

If this indeed has repercussions, we might want to revert the current changes and instead add a delay after channel.unbind() to make sure that the channel is unbound before unsubscribing from the socket.

@melvin-bot melvin-bot bot added the Overdue label Feb 13, 2023
@chiragsalian
Copy link
Contributor

Hmm okay, so I think your solution was fine @Prince-Mendiratta.

You mention your fix might have brought back this issue - #752. But i was not able to reproduce it. The issue is more than 2 years old.

With your solution prince I would think that unbinding from the event won't unsubscribe from the channel itself and maybe that's fine. We can create a follow-up issue to figure out how to unsubscribe from the channel itself so that it doesn't take up pusher space perhaps.

has this issue been in the repo since 3 years or did it just start popping up?!

Not sure, maybe no one noticed it before. Hard to say 🤷‍♂️ Not sure if it's worth the time and effort tracing through the past code IMO.

As a first step let's confirm if there are problems,

  1. Tagging @marcaaron if you can reproduce this issue on the latest App code since you created the issue to begin with. I could not reproduce the issue.
  2. To confirm if there is a problem only unsubscribing from the event but keeping the socket active. If there is no problem here I'm not sure if anything needs to be done.

@melvin-bot melvin-bot bot removed the Overdue label Feb 13, 2023
@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Feb 13, 2023

Cool, @chiragsalian We can this off this checklist!

@chiragsalian
Copy link
Contributor

Yup, updated

@marcaaron
Copy link
Contributor

Tagging @marcaaron if you can reproduce this #752 on the latest App code since you created the issue to begin with. I could not reproduce the issue.

Sorry, I won't have time to test this. If we can't reproduce it then let's consider it fixed.

@Santhosh-Sellavel
Copy link
Collaborator

@dylanexpensify bump for payment thanks!

@dylanexpensify
Copy link
Contributor

on it!

@dylanexpensify
Copy link
Contributor

@Santhosh-Sellavel did you apply? Can't see you on the job proposals in Upwork

@dylanexpensify
Copy link
Contributor

@Prince-Mendiratta sent offer!

@Prince-Mendiratta
Copy link
Contributor

@dylanexpensify accepted. Would this be eligible for a timeline bonus?

@dylanexpensify
Copy link
Contributor

@Prince-Mendiratta can you confirm your PR didn't lead to a regression? If so, then yes it's eligible!

@Prince-Mendiratta
Copy link
Contributor

@dylanexpensify Yes, can confirm, no regressions here. The issue we were talking about in the comment above was super old and we were unable to reproduce.

@Santhosh-Sellavel
Copy link
Collaborator

@dylanexpensify Applied now, yeah no regressions!

@dylanexpensify
Copy link
Contributor

Wooot!

@dylanexpensify
Copy link
Contributor

payment sent @Prince-Mendiratta with bonus!
offer sent @Santhosh-Sellavel !

@Prince-Mendiratta
Copy link
Contributor

thanks a lot everyone, cheers!

@dylanexpensify
Copy link
Contributor

payment sent @Santhosh-Sellavel !

@dylanexpensify
Copy link
Contributor

posted about RT steps

@dylanexpensify
Copy link
Contributor

alrighty, we're gonna do nothing for RT, so all good here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests