Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Handle inbound events from federation asynchronously #10272

Merged

Conversation

erikjohnston
Copy link
Member

Fixes #9490

Based on #10269

This will break a couple of SyTest that are expecting failures to be added to the response of a federation /send, which obviously doesn't happen now that things are asynchronous.

Two drawbacks:

  1. Currently there is no logic to handle any events left in the staging area after restart, and so they'll only be handled on the next incoming event in that room. That can be fixed separately.
  2. We now only process one event per room at a time. This can be fixed up further down the line.

@erikjohnston erikjohnston changed the base branch from develop to erikj/async_federation_base_branch June 29, 2021 17:40

# The common path is for the event we just received be the only event in
# the room, so instead of pulling the event out of the DB and parsing
# the event we just pull out the next event ID and check if that matches.
Copy link
Member Author

Choose a reason for hiding this comment

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

FWIW I don't know whether the extra complexity is worth saving fetching a single event from the DB, happy to delete this logic 🤷

Copy link
Member

Choose a reason for hiding this comment

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

🤷

@erikjohnston erikjohnston force-pushed the erikj/async_inbound_federation branch from f265174 to c2707da Compare June 29, 2021 17:42
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

looks generally about right

synapse/federation/federation_server.py Outdated Show resolved Hide resolved
synapse/storage/databases/main/event_federation.py Outdated Show resolved Hide resolved
synapse/storage/databases/main/event_federation.py Outdated Show resolved Hide resolved
synapse/storage/databases/main/event_federation.py Outdated Show resolved Hide resolved
erikjohnston and others added 6 commits June 29, 2021 19:32
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
…ing.sql

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
@richvdh richvdh force-pushed the erikj/async_inbound_federation branch from 280baea to f43cfe8 Compare June 29, 2021 18:32
@richvdh richvdh merged commit c54db67 into erikj/async_federation_base_branch Jun 29, 2021
@richvdh richvdh deleted the erikj/async_inbound_federation branch June 29, 2021 18:55
aaronraimist added a commit to aaronraimist/synapse that referenced this pull request Jun 30, 2021
Synapse 1.37.1rc1 (2021-06-29)
==============================

Features
--------

- Handle inbound events from federation asynchronously. ([\matrix-org#10269](matrix-org#10269), [\matrix-org#10272](matrix-org#10272))
erikjohnston added a commit that referenced this pull request Jun 30, 2021
erikjohnston added a commit that referenced this pull request Jun 30, 2021
aaronraimist added a commit to aaronraimist/synapse that referenced this pull request Jul 1, 2021
Synapse 1.37.1 (2021-06-30)
===========================

This release resolves issues (such as [matrix-org#9490](matrix-org#9490)) where one busy room could cause head-of-line blocking, starving Synapse from processing events in other rooms, and causing all federated traffic to fall behind. Synapse 1.37.1 processes inbound federation traffic asynchronously, ensuring that one busy room won't impact others. Please upgrade to Synapse 1.37.1 as soon as possible, in order to increase resilience to other traffic spikes.

No significant changes since v1.37.1rc1.

Synapse 1.37.1rc1 (2021-06-29)
==============================

Features
--------

- Handle inbound events from federation asynchronously. ([\matrix-org#10269](matrix-org#10269), [\matrix-org#10272](matrix-org#10272))
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jul 1, 2021
Synapse 1.37.1 (2021-06-30) ===========================

This release resolves issues (such as
[#9490](matrix-org/synapse#9490)) where
one busy room could cause head-of-line blocking, starving Synapse
from processing events in other rooms, and causing all federated
traffic to fall behind. Synapse 1.37.1 processes inbound federation
traffic asynchronously, ensuring that one busy room won't impact
others. Please upgrade to Synapse 1.37.1 as soon as possible, in
order to increase resilience to other traffic spikes.

No significant changes since v1.37.1rc1.


Synapse 1.37.1rc1 (2021-06-29) ==============================

Features --------

- Handle inbound events from federation asynchronously.
([\#10269](matrix-org/synapse#10269),
[\#10272](matrix-org/synapse#10272))
erikjohnston added a commit to matrix-org/complement that referenced this pull request Jul 5, 2021
erikjohnston added a commit to matrix-org/complement that referenced this pull request Jul 7, 2021
babolivier added a commit to matrix-org/synapse-dinsic that referenced this pull request Sep 1, 2021
Synapse 1.37.1 (2021-06-30)
===========================

This release resolves issues (such as [#9490](matrix-org/synapse#9490)) where one busy room could cause head-of-line blocking, starving Synapse from processing events in other rooms, and causing all federated traffic to fall behind. Synapse 1.37.1 processes inbound federation traffic asynchronously, ensuring that one busy room won't impact others. Please upgrade to Synapse 1.37.1 as soon as possible, in order to increase resilience to other traffic spikes.

No significant changes since v1.37.1rc1.

Synapse 1.37.1rc1 (2021-06-29)
==============================

Features
--------

- Handle inbound events from federation asynchronously. ([\#10269](matrix-org/synapse#10269), [\#10272](matrix-org/synapse#10272))
Fizzadar pushed a commit to Fizzadar/synapse that referenced this pull request Oct 26, 2021
Synapse 1.37.1 (2021-06-30)
===========================

This release resolves issues (such as [matrix-org#9490](matrix-org#9490)) where one busy room could cause head-of-line blocking, starving Synapse from processing events in other rooms, and causing all federated traffic to fall behind. Synapse 1.37.1 processes inbound federation traffic asynchronously, ensuring that one busy room won't impact others. Please upgrade to Synapse 1.37.1 as soon as possible, in order to increase resilience to other traffic spikes.

No significant changes since v1.37.1rc1.

Synapse 1.37.1rc1 (2021-06-29)
==============================

Features
--------

- Handle inbound events from federation asynchronously. ([\matrix-org#10269](matrix-org#10269), [\matrix-org#10272](matrix-org#10272))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

_room_pdu_linearizer starves other incoming transactions
3 participants