-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[e2e issue] client badly considers someone is not a room member #341
Comments
A similar issue occurs despite of client fix => Client starts and detect a corruption [INF][MX ] 08-02 10:15:48.993 | 15363 | MATRIX_LOG_WRAPPER | [MXFileStore] Warning: MXFileStore has been reset due to room file corruption. Room id: !DcIbyxKjjgxAxKtWjD:xxxx.com => It decides to perform an initial /sync again => For room "!aBlswEAkTSCrHQisTc:xxxx.com" in room.state it only gets information Jean-philippe RouaultTest is in invite state while he is indeed in joined state!
[INF][MX ] 08-02 10:15:49.448 | 1027 | MATRIX_LOG_WRAPPER | [MXSession] Received 2 joined rooms, 0 invited rooms, 0 left rooms in 139ms => My first fix detects the event in room.state is obsolet: so it means room.state has been reinitialized because of File system corruption? => client decides to get oldest messages in room !aBlswEAkTSCrHQisTc:xxxx.com (a consequence of initial sync??) And get again event Jean-philippe RouaultTest is invited and not Room Member [INF][MX ] 08-02 10:15:51.798 | 1027 | MATRIX_LOG_WRAPPER | [MxRoomState] The user is no more part of the room : event $15016590391065InGQi:xxxx.com: m.room.member - 2017-08-02 07:30:39 +0000: { => And next encrypted messages will not be readable for Jean-Philippe |
For back pagination management, if I understand well, when you go back in the room history, client really update real room state associated to room to reflect its state in the past. if you go back from 1 day in room history (by using a past timeline), matrix client will really remove (temporaly) member A from room state -> member. When you work with past timeline, would it be possible to backup current room state before to update it or to only work with a copy of current room state. So that there is no side effect or possibel current room state corruption. |
@Jean-PhilippeR room state copies are already made with
When you paginate in a room, there are two live instances of MXRoomState. The one returned by MXRoom.state, which represents the current state of the room, and one that is moving. It represents the state at the current position in the pagination. |
Good :) |
You need to look at the right direction :) and the property MXEventTimeline.isLiveTimeline. The MXTimelineDirectionForwards direction and isLiveTimeline = YES means that we are getting events that will update the live timeline. |
Thanks. I will try to improve my fix with additional checks. Did you understand in the logs I have reported why my fix has worked the first time (08-02 10:15:51.652) but not the second time (at 08-02 10:15:51.798)? |
I am a little confused with MxRoomState._isLive and [MXTimelineDirectionForwards direction and isLiveTimeline = YES.] I am not sure because when you perform a full sync I am not sure _IsLive is set to TRUE and I believe that my fix should be performed during a full sync. |
To get info [MXTimelineDirectionForwards direction and isLiveTimeline = YES.] I need to move my check in MxEventTimeline->handleStateEvent, right? But in this function there is already a check based on [MXTimelineDirectionForwards direction and isLiveTimeline Do you agree? Or shall we rework whole MxEventTimeLine -> handleStateEvent? For me this check shall be performed if it is Live Timeline, whatever direction is. Why to restrict it to Forward Direction? |
This is another test cas easily reproductible when my fix cannot work Same reason: On first sync after B has joined again room:
This PR is for iOS SDK. Should I create a PR dedicated to synapse? |
So I think I repro'ed this with, the crucial bit is the history visibility:
This is due to theoretically B not being allowed to see C's join as B wasn't joined at that point. This is meant to be handled by it turning up in state, but that then that gets clobbered by the timeline. (I will try and write an integration test for this to confirm.) |
I've also repro'ed:
|
This is fixed on develop of synapse: matrix-org/synapse#2451 and tested in: matrix-org/sytest#385 |
I have found an interesting and systematic issue related to e2e encryption on iOS and synapse.
A creates an e2e room with B
They send messages -> OK.
A invites C
C send a message: A can decrypt this message but not B.
After some investigation. I found the reason. C considers B is not a room member so it does not send him the needed megolm keys.
Problem is linked to MxRoomState -> handleStateEvent. He considers the user is no more part of the room and remove him.
If I have a look on the /sync response received by C just after he has joined the room:
B is in room->joins->state->events with state{ membership = join;type = "m.room.member";} => correct
But in timeline events , the last events we receive related to B is "B has been invited"
But the events related to "B has joined room" is missing even if more recent than event "B has been invited"
Last event in this timeline events is "C has joined room"
I can provide you in isntrumented log if you want.
So For me, there is an issue on Synapse which does not send correct event to C.
But client should be robust to this use case.
To conclude, I will try to implement following work around on client: if a m.room.member event in the timeline event is older than m.room.member state event associated to same member, its should be ignored.
But perhaps this issue concerns all state events.
I have added this check in MxRoomState -> handleStateEvent for RoomMember only. It seems to fix the issue.
Manu, do you think it is an acceptable work around? Or can we fix it in a better way?
The text was updated successfully, but these errors were encountered: