Potential for infinite recursion when last_event with status -1 is stored in database #1950
Open
1 of 2 tasks
Labels
bug
Something isn't working
Checklist
In which Project did the bug appear?
Other
If you selected "Other" as Project, please enter in which project the bug occurred.
No response
On which platform did the bug appear?
iOS, Safari
SDK Version
No response
Describe the problem caused by this bug
I have encountered a freezing issue and this seems to be its origin:
If a user has a last_event with status: -1 stored in their database in the rooms box (I found this in MatrixSdkDatabase), and they send an event, these functions are called:
sendEvent -> _handleFakeSync -> handleSync -> handleRooms -> storeRoomUpdate
storeRoomUpdate calls Room.fromJson on the content currently stored in the database, which calls Event.fromJson if the stored data has a last_event. In the Event constructor, if last_event has status: -1 and the event's age is over sendTimelineEventTimeout, it sets the event's messageSendingStatusKey to -2 and calls handleSync with that updated event. Then, as with above, these functions are called:
handleSync -> handleRooms -> storeRoomUpdate
When storeRoomUpdate tries to get the room data from the database, it hasn't been updated, so the same happens again over and over.
(Sorry for the lack of an actual stack trace, I haven't been able to replicate this error since clearing the database. I will add to this issue if I'm able to replicate it again.)
Steps To Reproduce
No response
Screenshots or Logs
No response
Security related
No response
The text was updated successfully, but these errors were encountered: