famedly / matrix-dart-sdk

Matrix SDK written in pure Dart.
GNU Affero General Public License v3.0
49 stars 31 forks source link

Store Room States by "roomID|type|statekey" key #1856

Open krille-chan opened 4 weeks ago

krille-chan commented 4 weeks ago

Preflight Checklist

Describe your problem

Currently we store room states by a roomID|type key and then store a Map of state_key->State Event in this. This produces a out of memory bug if the user has joined a room where there are a lot of states with the same type but different statekeys (not for m.room.member). This makes the app unusable in this case. See here that I ran into this already...

Describe your ideal solution

I've checked out the database code and for the new Matrix SDK Database I don't find a blocker to just move to a roomID|type|statekey triple key. Just needs a refactoring everywhere where we access the two state event boxes. However this would need a change in the behavior of Important State Events as we would no longer be able to say that we want to load all events of a certain type, but need to also specify the state_key (which is an empty String "" in most of the cases). The question is, is this a blocker actually? I don't see any implementation where we aren't able to also define the state_key.

Version

No response

Security requirements

No response

Additional Context

No response

krille-chan commented 4 weeks ago

as this fixes a problem which makes an app with this SDK unusable when joining a specific room, I would mark this as high priority!