krille-chan / fluffychat

The cutest instant messenger in the [matrix]
https://fluffychat.im/
GNU Affero General Public License v3.0
1.21k stars 220 forks source link

OOM on initial sync #814

Open austinhuang0131 opened 10 months ago

austinhuang0131 commented 10 months ago

Bug Description

# [ERROR] Error during processing events - Out of Memory
#0      new Uint8List.fromList (dart:typed_data-patch/typed_data_patch.dart)
#1      ByteStream.toBytes.<anonymous closure> (package:http/src/byte_stream.dart)
#2      _ByteCallbackSink.close (dart:convert/byte_conversion.dart)
#3      _RootZone.runGuarded (dart:async/zone.dart)
#4      _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.dart)
#5      _FutureListener.handleWhenComplete (dart:async/future_impl.dart)
#6      Future._propagateToListeners.handleWhenCompleteCallback (dart:async/future_impl.dart)
#7      Future._propagateToListeners (dart:async/future_impl.dart)
#8      Future._prependListeners.<anonymous closure> (dart:async/future_impl.dart)
#9      _microtaskLoop (dart:async/schedule_microtask.dart)
#10     _startMicrotaskLoop (dart:async/schedule_microtask.dart)
#11     _rootRun (dart:async/zone.dart)
#12     _CustomZone.run (dart:async/zone.dart)
#13     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart)
#14     _microtaskLoop (dart:async/schedule_microtask.dart)
#15     _startMicrotaskLoop (dart:async/schedule_microtask.dart)

Steps to Reproduce

It seems to only be for my account and I don't know the exact conditions.

  1. Log in.
  2. Wait for initial sync to finish.

Expected Behavior

Initial sync finishes.

App Version

1.17.0 (F-Droid); also present in past version but without logs appearing

Additional Platform Information

Android 9 (Sony H3123)

Additional Context

No response

krille-chan commented 10 months ago

Do you have some more info how much memory your device has an how big your room is?

austinhuang0131 commented 10 months ago

3 GB?

It's an initial sync. I have around 260 DMs and 80 rooms; some (like 10) of them are quite active but are not at Matrix HQ level of madness.

morguldir commented 9 months ago

I think this is mostly the same as #792, except the iOS app just freezes for a second when it ooms, i can also see iOS suspending every background app for fluffychat and it getting warmer Like noted in #792 though, the spaces list works and if you go to a room you can see that it's actually synced, it's just the room list / chat backup that isn't working.

Note that I'm using multi account support, have 6gb of ram, and my account is pretty large, my main personal account with just like 20 dm rooms loads fine though.

Submitted a testflight screenshot, but not sure what that does, can't seem to copy the logs on iOS, but they mention OOM from SqfliteDatabaseMixin

morguldir commented 9 months ago

Reproducable by joining https://matrix.to/#/#community-moderation-effort-bl:neko.dev

Seems like you need to log back out if it's already stuck though, and it doesn't effect existing logins, although it might just have been slow to propagate

This is where it was stuck for me, looked like infinite recursion with m.policy.user events https://github.com/famedly/matrix-dart-sdk/blob/566f960b921a3ab691d8481441a6167b808a278e/lib/src/client.dart#L2119-L2121

TheArcaneBrony commented 9 months ago

@morguldir I don't think its recursing, its just that CME has thousands of user policy events

Screenshot from 2024-01-27 02-26-28

morguldir commented 9 months ago

What does that have to do with FluffyChat using over 6gb of ram :3

morguldir commented 9 months ago

Or maybe you're right, just matrix-org-coc-bl put it to 4gb, which my browser was allowed to use. So I guess it uses too much ram trying to map the policy lists, which crashes due to costing too much ram, and then it retries but crashes again :thinking:

Kladki commented 7 months ago

Same issue here.

What is interesting in my case is that it becomes almost unresponsive, only updating the screen every 10-30 seconds.

Kladki commented 7 months ago

Specifically, I can reproduce this by joining https://matrix.to/#/#community-moderation-effort-bl:neko.dev on any of my accounts on my phone.

Kladki commented 7 months ago

Seems like you need to log back out if it's already stuck though, and it doesn't effect existing logins, although it might just have been slow to propagate

For me it did effect one of my existing logins.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 120 days with no activity.

austinhuang0131 commented 3 months ago

silence stalebot