Open izarutskaya opened 1 month ago
@Guccio163 - I was able to reproduce the bug. To do so, we need to resize the window to a size smaller than the screen size.
https://github.com/user-attachments/assets/15801f9e-4a48-4864-a070-f9132f35e8c0
Console Logs: dev.new.expensify.com-1728983762370.log
Thanks for the insight @rayane-djouah, I'll try this one in a moment! 🫶
Hi @Christinadobrzyn, I'm coming with my conclusions on this issue: There's a list of tests I performed here to try and reproduce the bug:
Reported bug behaviour: App freezes and doesn't respond
Current observed behaviour (One of two, non-deterministic) :
Moreover I'm pretty much sure that this bug isn't connected to Search at all; To illustrate the non-deterministic nature of this bug, below are recordings of app behaviour with and without the search-related steps:
In my opinion incorrect behaviour isn't linked to Search and is purely matter of "Clear cache and restart" button; Maybe the contributor that added this feature or someone with bigger Onyx knowledge could take this and dive into the button's functionality?
Hi @Guccio163! Thank you so much for the thorough review. It sounds like we need to find an Onyx person to investigate more. I think @kidroca does Onyx stuff but I don't know if it relates to this kind of job.
@tylerkaraszewski or @rayane-djouah do you know who else we might be able to reach out to about this?
@tylerkaraszewski or @rayane-djouah do you know who else we might be able to reach out to about this?
@Christinadobrzyn, the feature was worked on by @TMisiukiewicz in this PR: https://github.com/Expensify/App/pull/35306
Awesome, thanks @rayane-djouah! I reached out to the Callstack team to see if they might have someone with Onyx experience to help! https://expensify.slack.com/archives/C03UK30EA1Z/p1729654603736149
Hey, I'll take a look on this later this week 👍
Awesome! Thank you @TMisiukiewicz!
Started investigating it, I couldn't reporoduce it based on the steps provided in the issue. However, the browser tab hang to me once when I did clear a couple of times, it felt like each next clear is slowing down the app, however I haven't done any measurements yet. I'll continue looking into that on Monday
I was able to reproduce it with 6x CPU throttling enabled in devtools. However, it was impossible to record a profiling trace because the devtools freezes together with the app 😞 One thing I noticed is the fact that my app hangs every time after merge
being called on personalDetailsList
with more than 8k reports. @izarutskaya mind trying it out on your own? Please open a Chrome devtools and go to Console tab, enable All levels for logs and try to reproduce the bug. What is the last log before it freezes? Is it any kind of Onyx action with a large payload?
Thanks for the testing @TMisiukiewicz - reaching out to QA to see if they can test again based on those instructions. https://expensify.slack.com/archives/C9YU7BX5M/p1730176431155529
Still reproducible but I am not sure what should I see. Check please my video Build v9.0.55-2
https://github.com/user-attachments/assets/581fa8aa-6516-4df6-8424-e5f3663ded7e
@izarutskaya thanks, looks like it hangs exactly at the same point.
So today I was finally able to reproduce it and found the root cause. When we open the Search in chats selector, we initialize the option list to load the items that are visible in the list: https://github.com/Expensify/App/blob/65fa00a002b3603d335e9a3180b10d6fa365cd58/src/components/Search/SearchFiltersChatsSelector.tsx#L46-L48
This means, now every time the personalDetails
list change, we will fall into this useEffect and execute the whole code since the early return won't work anymore:
https://github.com/Expensify/App/blob/65fa00a002b3603d335e9a3180b10d6fa365cd58/src/components/OptionListContextProvider.tsx#L82-L128
As you can see, it loops through all the personal details, and for each single one of them, it loops through all reports using filter
and then forEach
. This issue probably occurs only on heavy loaded accounts - for me it's reproducible on account where I have 8,5k personal details and more than 15k reports. I was able to measure it using profiler and it blocks my app for 50 seconds:
And here is the confirmation that loops mentioned earlier are responsible for that:
In this useEffect we have early return comparing the previous value of personal details with the current one, and it should do the work in all the other cases where this value gets updated. However in here it's kinda specific scenario, and it will never fall into this early return because the previous value of personal details is just an empty object, so we run the code for each one of them.
Haven't tested any solution yet, but first and easiest thing that comes to my mind is just setting areOptionsInitialized
to false
when clearing the cache. Will test it tomorrow morning and open a PR if it works properly.
PR open: https://github.com/Expensify/App/pull/51725
mind checking if the issue is gone on your side when testing out this branch?
I'll be ooo until the end of the week so @MrRefactor will take care of this if needed
I will adjust PR and upload all of the recordings necessary!
PR open: #51725
mind checking if the issue is gone on your side when testing out this branch?
I have tested the branch and confirmed that it resolves the bug 👍 - https://github.com/Expensify/App/pull/51725#issuecomment-2453221465
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.0.35-7 Reproducible in staging?: Y Reproducible in production?: N Found when validating PR : https://github.com/Expensify/App/pull/49258 Email or phone of affected tester (no customers): applausetester+bp0916w@applause.expensifail.com Logs: https://stackoverflow.com/c/expensify/questions/4856 Issue reported by: Applause-Internal team
Action Performed:
Precondition; logged in application.
Expected Result:
App doesn't crash. App doesn'r freeze
Actual Result:
App is freezed
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
https://github.com/user-attachments/assets/a3ed06fc-0200-4ae0-b91c-7a0f470f6a15
View all open jobs on GitHub
Upwork Automation - Do Not Edit