element-hq / element-hq/synapse

Concurrent `/messages` requests backwards in the timeline lead to lots of resource use.

Open
#18,829 1 comment 0 reactions 0 assignees View on GitHub
A-Messages-Endpoint
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

When a glob rule is added to a policy room in Draupnir, the bot will request `/messages` within lots of rooms. Currently this is naively implemented in Draupnir, so if there are lots of rules added at the same time, draupnir will send duplicate requests requesting the same information. The requests to`/messages` will consistently take more than a minute to respond even for requests about rooms that have no timeline activity. And even when Synapse is deployed with reasonable hardware and a variety of worker configurations.

Draupnir requests `/messages` backwards with no `from` token.

Requests are also made when draupnir bans users with a room event filter with the `senders` property filled with the target of the ban. And these can also suffer.

While on the draupnir side we will obviously try to call `/messages` less. Synapse probably shouldn't be responding this way.

While I wish I had more details, but it's either this or the issue doesn't get documented. i imagine that it should be fairly obvious in synapse's `/messages` handler why this is causing such an issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.