element-hq / element-hq/element-x-android
RustMatrixRoom is created multiple times when entering the room
- Dominant language
- Kotlin
- Stars
- 2.4k
- Forks
- 624
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 149
Description
### Steps to reproduce
Just entering any room after app launch. The `RustMatrixRoom` is created multiple times for the same `roomId` and `sessionId` when entering the room which leads to flows being subscribed multiple times without releasing the resources.
### Outcome
#### What did you expect?
The room should be created only once, or all resources should be cleaned up and scopes canceled before recreating a new instance.
#### What happened instead?
The `RustMatrixRoom` is created multiple times when entering the room, which leads to flows being subscribed multiple times without releasing the previously allocated resources.
2025-04-09 22:56:21.362 11597-11665 org.matrix.rust.sdk io.element.android.x.debug I elementx: Room_debug_tag, RustMatrixRoom init[thread=DefaultDispatcher-worker-9] | RustMatrixRoom.kt:204
2025-04-09 22:56:21.370 11597-11597 org.matrix.rust.sdk io.element.android.x.debug D elementx: Room_debug_tag, RustMatrixRoom combine flow onStart, thread=main | RustMatrixRoom.kt:220
2025-04-09 22:56:21.527 11597-11597 org.matrix.rust.sdk io.element.android.x.debug D elementx: Room_debug_tag, RustMatrixRoom membershipChangeEventReceived flow onStart, thread=main | RustMatrixRoom.kt:209
2025-04-09 22:56:21.812 11597-11658 org.matrix.rust.sdk io.element.android.x.debug I elementx: Room_debug_tag, RustMatrixRoom init[thread=DefaultDispatcher-worker-5] | RustMatrixRoom.kt:204
2025-04-09 22:56:21.996 11597-11597 org.matrix.rust.sdk io.element.android.x.debug D elementx: Room_debug_tag, RustMatrixRoom combine flow onStart, thread=main | RustMatrixRoom.kt:220
2025-04-09 22:56:22.080 11597-11597 org.matrix.rust.sdk io.element.android.x.debug D elementx: Room_debug_tag, RustMatrixRoom membershipChangeEventReceived flow onStart, thread=main | RustMatrixRoom.kt:209
### Your phone model
Plain Android Studio Emulator
### Operating system version
Android 15
### Application version and app store
The latest version from develop (25.04.0)
### Homeserver
_No response_
### Will you send logs?
No
### Are you willing to provide a PR?
No
Contributor guide
Assessment
This issue has not been assessed yet.