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

Fix race conditions around threads #2331

Merged
merged 10 commits into from
May 3, 2022
Merged

Fix race conditions around threads #2331

merged 10 commits into from
May 3, 2022

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Apr 29, 2022

Part of matrix-org/matrix-react-sdk#8448 which fixes element-hq/element-web#21627


Here's what your changelog entry will look like:

🐛 Bug Fixes

@t3chguy t3chguy removed the T-Defect label May 3, 2022
@t3chguy t3chguy added Dependencies Pull requests that update a dependency file T-Defect and removed Dependencies Pull requests that update a dependency file labels May 3, 2022
@t3chguy t3chguy marked this pull request as ready for review May 3, 2022 11:57
@t3chguy t3chguy requested a review from a team as a code owner May 3, 2022 11:57
Copy link
Contributor

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I understand of this looks sensible.

@t3chguy t3chguy merged commit ac5fee0 into develop May 3, 2022
@t3chguy t3chguy deleted the t3chguy/fix/21627 branch May 3, 2022 13:25
);
}
}
});
}
Copy link
Contributor

@MadLittleMods MadLittleMods May 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What symptoms do the changes in this PR fix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race conditions of events coming in as the thread is being created async during a subsequent /sync response, now threads are always created and stored synchronously (so findEventById continue to function) then more data is fetched into them as soon as possible

Why?

Copy link
Contributor

@MadLittleMods MadLittleMods May 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What bugs in the UI manifested before that spawned this change? Is it just a refactor after noticing the potential race?

There is no context around why/what besides the code itself.

I was curious because I saw this PR as a "What's new?" item when updating and checking whether this fixes this sort of problem, https://github.com/matrix-org/element-web-rageshakes/issues/12681

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no context around why/what besides the code itself.

Its in the backref'd PR

matrix-org/matrix-react-sdk#8448
element-hq/element-web#21627

I was curious because I saw as a "What's new?" item when updating and checking whether this fixes this sort of problem, https://github.com/matrix-org/element-web-rageshakes/issues/12681

Unlikely, that looks more like element-hq/element-web#21613 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its in the backref'd PR

matrix-org/matrix-react-sdk#8448
vector-im/element-web#21627

ohh, that's confusing just following the same name PR breadcrumbs in the activity log. I added those links to the PR description.

Thanks for the context 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we only link from the downstream project upstream, given that js-sdk shouldn't be tailoring to a specific consumer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems a bit backwards.

The usage of matrix-js-sdk is where new bugs are found and new usages are desired. Giving examples and explaining that these race conditions can cause reactions not to show on threaded messages because of xxx, is pretty relevant to the changes here.

I think even more context should be explained here besides linking to those issues btw. I don't know what the code is actually doing here but it could explain something like, "Instead of adding events directly to the timeline, we emit ThreadEvent.Update which clients can react to and refresh the timeline. This fixes the order so that whatever is not missing in a race when this happens."

su-ex added a commit to SchildiChat/matrix-js-sdk that referenced this pull request May 10, 2022
* Live location sharing: handle encrypted messages in processBeaconEvents ([\matrix-org#2327](matrix-org#2327)).
* Fix race conditions around threads ([\matrix-org#2331](matrix-org#2331)). Fixes element-hq/element-web#21627.
* Ignore m.replace relations on state events, they're invalid ([\matrix-org#2306](matrix-org#2306)). Fixes element-hq/element-web#21851.
* fix example in readme ([\matrix-org#2315](matrix-org#2315)).
* Don't decrement the length count of a thread when root redacted ([\matrix-org#2314](matrix-org#2314)).
* Prevent attempt to create thread with id "undefined" ([\matrix-org#2308](matrix-org#2308)).
* Update threads handling for replies-to-thread-responses as per MSC update ([\matrix-org#2305](matrix-org#2305)). Fixes element-hq/element-web#19678.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reactions from others not being rendered in threads
3 participants