Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.46k stars 2.82k forks source link

[HOLD for payment][Bug] After typing even a mildly long comment in the Android compose box, the whole app starts to hang #11321

Closed mvtglobally closed 1 year ago

mvtglobally commented 2 years ago

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. Open a chat -- even an empty one
  2. Just start typing a ton on the keyboard. Not copy/pasting, just finger-smash the keyboard for about 30s

Expected Result:

App should respond quickly

Actual Result:

After typing even a mildly long comment in the Android compose box, the whole app starts to hang.

Workaround:

unknown

Platform:

Where is this issue occurring?

Version Number: 1.2.3-0 Reproducible in staging?: Reproducible in production?: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation image - 2022-09-27T002415 487

Expensify/Expensify Issue URL: Issue reported by: @JmillsExpensify @quinthar Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1663172358453739

View all open jobs on GitHub

melvin-bot[bot] commented 2 years ago

Triggered auto assignment to @johncschuster (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

melvin-bot[bot] commented 2 years ago

Triggered auto assignment to @Beamanator (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

Beamanator commented 2 years ago

Hmm I believe this should be able to be investigated by contributors so I'll make it External, but at the moment I'm having trouble reproducing - I logged in on my Android device, mashed the keyboard for a long time, didn't see any slowdown ๐Ÿค” It seems this might have to happen in a HT account, even thought it seems like @mvtglobally tried testing on a HT account already, right?

melvin-bot[bot] commented 2 years ago

Triggered auto assignment to @kadiealexander (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

melvin-bot[bot] commented 2 years ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (External)

melvin-bot[bot] commented 2 years ago

Current assignee @Beamanator is eligible for the External assigner, not assigning anyone new.

kadiealexander commented 2 years ago

@Beamanator I was able to repro this on an asus phone with android 12, but it took quite a long message (40k characters).

kadiealexander commented 2 years ago

https://www.upwork.com/jobs/~01ada9667fd1d8d5a9 https://www.upwork.com/ab/applicants/1576766472536219648/job-details

quinthar commented 2 years ago

I am so confused, this is incredibly easy to reproduce with 100% consistency on my Pixel 5 within about 10 seconds. Just:

  1. Open the app and sign into an account (or create a new one)
  2. Open any chat, even a new one
  3. Just drum your fingers over the keyboard repeatedly
  4. After about 10s it should hang
  5. If that doesn't work, just find a long message, and hold down backspace -- then it'll quickly hang

Are you saying that those steps do not reproduce it for you?

Beamanator commented 2 years ago

Hmm I'm on a Samsung Galaxy A72 and I followed your exact steps, didn't see anything hang or really slow down at all ๐Ÿคท

quinthar commented 2 years ago

Just did a fresh uninstall/reinstall on my Pixel 5, created a new account, and was able to reproduce in about 15 seconds:

image

The keyboard is still working in that I am still able to press keys, but the input box is hung and no new input actually goes into it. I suspect it has something to do with saving the draft too quickly? Do we batch changes to the draft, or save fresh with every keystroke?

Beamanator commented 2 years ago

Interesting, I was able to reproduce on a Pixel 4 simulator! Though after mashing the keyboard of my Samsung Galaxy A72 for literally a minute, I still didn't see any slowdown ๐Ÿคท

As for saving the draft to Onyx, it looks like we do debounce here: https://github.com/Expensify/App/blob/1a42cf8a48bcb51b7b469f342a3f122de7aaef34/src/pages/home/report/ReportActionCompose.js#L117

That ^ debounce looks like it's working properly, so I'm not sure what else would be causing this, I think this should be part of the WhatsApp Quality project so I'll add it there

Beamanator commented 1 year ago

Waiting on proposals, I think we can double this to make it more enticing @kadiealexander

kadiealexander commented 1 year ago

Price doubled!!

JmillsExpensify commented 1 year ago

Aren't we already working on resolving this issue with this PR?

mallenexpensify commented 1 year ago

@sobitneupane , do you think the fix for this will also fix https://github.com/Expensify/App/issues/11954?

sobitneupane commented 1 year ago

Both the issues are related to long text and looks like we already have a PR up for improving input performance. So, I suggest holding both the issues.

cc: @Beamanator @mallenexpensify

Beamanator commented 1 year ago

Good call @JmillsExpensify & @sobitneupane - I agree lets put this on hold for now to see if https://github.com/Expensify/App/pull/11684 fixes this one ๐Ÿ‘

hannojg commented 1 year ago

Hey guys, I have already tested with @quinthar manually if https://github.com/Expensify/App/pull/11684 fixes this issue. Unfortunately, it doesn't.

Up until today, I wasn't able to reproduce the issue myself. @Beamanator you said you were able to reproduce the issue with a Pixel 4 simulator, that sounds great. Can you share the specs/ .ini file of your emulator?

I really would like to fix this bug, but def need a reproduction ๐Ÿ‘

Beamanator commented 1 year ago

Hey @hannojg ! Yes I'll re-test on the Pixel 4 simulator and keep you posted :D

Can you share the specs/ .ini file of your emulator?

Hmm how can I find this file? ๐Ÿ˜… Now that I'm looking, I see a config.ini, hardware-qemu.ini, and emulator-user.ini - are you interested in one of the first two?

Beamanator commented 1 year ago

Looks like Github doesn't support those .ini file format, I can upload to Google Drive or Slack

hannojg commented 1 year ago

@Beamanator Usually your emulators are stored in your home directory under the following path:

~/.android/avd/YOUR_EMULATOR_NAME.avd/config.ini, so the config.ini is of most interest.

in addition to that your .android/avd/YOUR_EMULATOR_NAME.ini file would be interesting!

I can upload to Google Drive or Slack

Oh yeah sure, or you just create a code comment with ``` and post it here as text ๐Ÿ˜Š

Beamanator commented 1 year ago

Note: On the simulator, after smashing the keyboard for a while and experiencing the app pretty much hanging, if I close the report, navigate to another, then navigate back, it didn't seem slow anymore. The video from my test didn't save ๐Ÿ™ƒ so I'll try again in a bit

Here's the config.ini file:

AvdId = Pixel4
PlayStore.enabled = true
abi.type = arm64-v8a
avd.ini.displayname = Pixel4
avd.ini.encoding = UTF-8
disk.dataPartition.size = 6442450944
fastboot.chosenSnapshotFile = 
fastboot.forceChosenSnapshotBoot = no
fastboot.forceColdBoot = no
fastboot.forceFastBoot = yes
hw.accelerometer = yes
hw.arc = false
hw.audioInput = yes
hw.battery = yes
hw.camera.back = virtualscene
hw.camera.front = emulated
hw.cpu.arch = arm64
hw.cpu.ncore = 4
hw.dPad = no
hw.device.hash2 = MD5:6b5943207fe196d842659d2e43022e20
hw.device.manufacturer = Google
hw.device.name = pixel_4
hw.gps = yes
hw.gpu.enabled = yes
hw.gpu.mode = auto
hw.initialOrientation = Portrait
hw.keyboard = yes
hw.lcd.density = 440
hw.lcd.height = 2280
hw.lcd.width = 1080
hw.mainKeys = no
hw.ramSize = 1536
hw.sdCard = yes
hw.sensors.orientation = yes
hw.sensors.proximity = yes
hw.trackBall = no
image.sysdir.1 = system-images/android-33/google_apis_playstore/arm64-v8a/
runtime.network.latency = none
runtime.network.speed = full
sdcard.size = 512M
showDeviceFrame = yes
skin.dynamic = yes
skin.name = pixel_4
skin.path = /Users/alexbeaman/Library/Android/sdk/skins/pixel_4
tag.display = Google Play
tag.id = google_apis_playstore
vm.heapSize = 256
Beamanator commented 1 year ago

And here's my Pixel4.ini file:

avd.ini.encoding=UTF-8
path=/Users/alexbeaman/.android/avd/Pixel4.avd
path.rel=avd/Pixel4.avd
target=android-33
hannojg commented 1 year ago

Thx! may i ask on which OS your computer is on? (if its macOS, are you running on an M1?)

Beamanator commented 1 year ago

Here's what my test looked like

https://user-images.githubusercontent.com/3885503/196717445-590c1d88-8c87-4076-9b2a-38fcd9df1d4c.mov

may i ask on which OS your computer is on? (if its macOS, are you running on an M1?)

Sure thing, yes I'm on a macOS (12.6), Chip: M1 Max

hannojg commented 1 year ago

Great, I am able to reproduce that! I have to say that I have to input text extremely fast with the help of adb shell input text to cause the ANR, however, I think the reproduction still translates to the issue we are seeing on real devices.

I am looking into that issue now ๐Ÿ˜Š Thx for the help @Beamanator

(I have the suspicion it might be something with the android version, lets see)

quinthar commented 1 year ago

Oh great yes, that's exactly what I'm experiencing!

quinthar commented 1 year ago

@hannojg any luck? Excited for this one!

hannojg commented 1 year ago

Not yet, will work on it this week, will keep y'all updated ๐Ÿ˜Š

techievivek commented 1 year ago

Note: Something similar happened here(but the char count is extremely high 51k so I suppose this is expected) but it will be good to counter all the platforms and not just Android.

melvin-bot[bot] commented 1 year ago

๐Ÿ“ฃ @hannojg You have been assigned to this job by @Beamanator! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review ๐Ÿง‘โ€๐Ÿ’ป Keep in mind: Code of Conduct | Contributing ๐Ÿ“–

Beamanator commented 1 year ago

Assigning @hannojg so your comments also clear the Overdue status :D

kadiealexander commented 1 year ago

@hannojg don't forget to apply on Upwork so we can issue payment when it's due! :)

quinthar commented 1 year ago

Any luck with this? This issue makes the app entirely unusable for me.

hannojg commented 1 year ago

Hey, I spend some more hours on this. I can exclude now more parts that aren't causing the issue, but still can't tell which one is exactly causing it.

It's a bit hard to estimate, but I think after ~5 more hours I should find the bug.

Do you want me/us to continue investigating in that issue (asking because it becomes a bit of a time sink) @quinthar ?

quinthar commented 1 year ago

Yes please do. Thanks!

On Mon, Oct 31, 2022, 6:20 AM Hanno J. Gรถdecke @.***> wrote:

Hey, I spend some more hours on this. I can exclude now more parts that aren't causing the issue, but still can't tell which one it is exactly.

It's a bit hard to estimate, but I think after ~5 more hours I should find the bug.

Do you want me/us to continue investigating in that issue (asking because it becomes a bit of a time sink) @quinthar https://github.com/quinthar ?

โ€” Reply to this email directly, view it on GitHub https://github.com/Expensify/App/issues/11321#issuecomment-1297078734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMNUQ4ADBV3WAQ5LK4D3LWF7BQZANCNFSM6AAAAAAQWMQIPE . You are receiving this because you were mentioned.Message ID: @.***>

mallenexpensify commented 1 year ago

@hannojg any update? Would love to get this fixed for ~DB~ Android users, there are also other issues held on this fix. Bumping to Daily

hannojg commented 1 year ago

Haven't continued yet, you can expect results latest by the end of this week!

quinthar commented 1 year ago

Haha, thank you. I'd love to be able to, you know, use our own app.

On Wed, Nov 2, 2022 at 9:25 AM Hanno J. Gรถdecke @.***> wrote:

Haven't continued yet, you can expect results latest by the end of this week!

โ€” Reply to this email directly, view it on GitHub https://github.com/Expensify/App/issues/11321#issuecomment-1300827127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMNUWNWNN5Q25WGRJYHBDWGKIWVANCNFSM6AAAAAAQWMQIPE . You are receiving this because you were mentioned.Message ID: @.***>

hannojg commented 1 year ago

Okay, I found the cause for the ANR. When removing the ReportsActionList it stopped happening. I then checked more specifically, and when removing the inverted prop in the BaseInvertedFlatListlist, the ANR isn't happening anymore.

I don't have an explanation yet for why the inverted list is causing the issue. Will continue to investigate and to find a fix. Will keep you updated.

Maybe @quinthar you want to try out if the removal also fixes the issue on your end, here is an APK for testing:

https://drive.google.com/file/d/1HvRg_d97D-R0YlGD49MEqr-ByC9VYBXU/view?usp=sharing

quinthar commented 1 year ago

Awesome!

On Thu, Nov 3, 2022, 3:10 AM Hanno J. Gรถdecke @.***> wrote:

Okay, I found the cause for the ANR. When removing the ReportsActionList it stopped happening. I then checked more specifically, and when removing the inverted prop in the BaseInvertedFlatListlist, the ANR isn't happening anymore.

I don't have an explanation yet for why the inverted list is causing the issue. Will continue to investigate and to find a fix. Will keep you updated

โ€” Reply to this email directly, view it on GitHub https://github.com/Expensify/App/issues/11321#issuecomment-1301879813, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMNUWTZ2I4KLXNWMZ33YDWGOFPZANCNFSM6AAAAAAQWMQIPE . You are receiving this because you were mentioned.Message ID: @.***>

JmillsExpensify commented 1 year ago

Nice one! @quinthar have you had a chance to take the APK for a spin yet? Does that resolve your issue?

quinthar commented 1 year ago

I have not, can you send me a link?

On Thu, Nov 3, 2022, 3:42 PM Jason Mills @.***> wrote:

Nice one! @quinthar https://github.com/quinthar have you had a chance to take the APK for a spin yet? Does that resolve your issue?

โ€” Reply to this email directly, view it on GitHub https://github.com/Expensify/App/issues/11321#issuecomment-1302760052, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMNURIZ7BGGH5DKN5SWETWGQ5VDANCNFSM6AAAAAAQWMQIPE . You are receiving this because you were mentioned.Message ID: @.***>

JmillsExpensify commented 1 year ago

Ah ya, it's here: https://drive.google.com/file/d/1HvRg_d97D-R0YlGD49MEqr-ByC9VYBXU/view?usp=sharing

quinthar commented 1 year ago

Wooohooo!!!! Seems to work!!!!!!! (but shows messages in the wrong order)

On Thu, Nov 3, 2022 at 4:22 PM Jason Mills @.***> wrote:

Ah ya, it's here: https://drive.google.com/file/d/1HvRg_d97D-R0YlGD49MEqr-ByC9VYBXU/view?usp=sharing

โ€” Reply to this email directly, view it on GitHub https://github.com/Expensify/App/issues/11321#issuecomment-1302783819, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMNUWLLQMEVPDJKN7I3J3WGRCLRANCNFSM6AAAAAAQWMQIPE . You are receiving this because you were mentioned.Message ID: @.***>

melvin-bot[bot] commented 1 year ago

@Beamanator, @hannojg, @sobitneupane, @kadiealexander Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Beamanator commented 1 year ago

@hannojg is making great progress! ๐Ÿ‘ (just updating Melvin)

Beamanator commented 1 year ago

Just updated this issue, so not overdue Melvin ๐Ÿ™ƒ

JmillsExpensify commented 1 year ago

Also asked for the latest in Slack.