Skip to content
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

Potential for infinite recursion when last_event with status -1 is stored in database #1950

Open
1 of 2 tasks
ggurdin opened this issue Oct 30, 2024 · 0 comments
Open
1 of 2 tasks
Assignees
Labels
bug Something isn't working

Comments

@ggurdin
Copy link
Contributor

ggurdin commented Oct 30, 2024

Checklist

  • I could not find a solution in the documentation, the existing issues or discussions.
  • I already asked for help in the chat

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

@ggurdin ggurdin added the bug Something isn't working label Oct 30, 2024
@coder-with-a-bushido coder-with-a-bushido self-assigned this Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants