Skip to content

Comments

fix: provide remote servers a way to find out about an event created during the remote join handshake#19390

Open
FrenchGithubUser wants to merge 1 commit intoelement-hq:developfrom
famedly:join-race-condition
Open

fix: provide remote servers a way to find out about an event created during the remote join handshake#19390
FrenchGithubUser wants to merge 1 commit intoelement-hq:developfrom
famedly:join-race-condition

Conversation

@FrenchGithubUser
Copy link

@FrenchGithubUser FrenchGithubUser commented Jan 19, 2026

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

TLDR

Use a "dummy" event to tie together forward extremities, and proactively send it to all servers in the room. This allows recently joined servers to become aware of recent events that would otherwise have "slipped through the cracks" and thus not be retrievable.

NOTE: While this does send the "dummy" event to all servers in the room, regardless of if they should care or not, at some point a new event will reference this dummy event and require it's retrieval. Since it was proactively sent, this will now not be necessary. This assists in preventing forks in the DAG

Alternatives

Unlike famedly/synapse#51 which 'pushes' the missing event directly, this causes the event to be 'pulled' by referencing it as a prev_event of a dummy event. Since the 'dummy event' does not get passed into the client, it is effectively invisible.

Draw-backs of famedly/synapse#51 meant it was not always certain if the 'pushed event' would show up in /sync or in /messages, but usually was in /sync. This method always has the 'missing event' show up in /messages, which I feel is more technically correct as that event was(albeit just barely) created before the 'join event' is persisted.

The Process

The order of events:

  1. make_join from remote server, response sent
  2. Message A sent from local server
  3. send_join from remote server, response from local server. Message A is not in this(as it is not state and is not referenced in any events that are included). Join event is persisted on local server.
  4. Local server realizes there are two forward extremities just after persisting the join event.
    A. Creates a org.matrix.dummy_event that has prev_events containing both the join and message A.
    B. Sends this dummy event to all servers in the room.
  5. Remote server receives the dummy event via it's /send endpoint, saves it in a queue until the partial state join begins syncing additional room state

@CLAassistant
Copy link

CLAassistant commented Jan 19, 2026

CLA assistant check
All committers have signed the CLA.

@FrenchGithubUser FrenchGithubUser marked this pull request as ready for review January 19, 2026 11:36
@FrenchGithubUser FrenchGithubUser requested a review from a team as a code owner January 19, 2026 11:36
@FrenchGithubUser
Copy link
Author

I am submitting this PR as an employee of Famedly, who has signed the corporate CLA, and used my company email in the commit.

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

Hi @FrenchGithubUser. As far as the Element Backend team is aware, Famedly has not yet signed the CCLA. However this is apparently currently in progress.

Holding off on review until that's resolved. Regardless, thank you for submitting your work upstream!

@ara4n
Copy link
Member

ara4n commented Feb 12, 2026

famedly has now signed the ccla :)

@MadLittleMods MadLittleMods requested a review from a team February 12, 2026 00:48
@sandhose
Copy link
Member

@FrenchGithubUser I think to allow the CLA bot to let you through, your membership to the famedly organisation must be public

If you don't want that to be the case, I can add you specifically to the list of allowed users, but making the org membership public is easier for us :)

@FrenchGithubUser
Copy link
Author

@sandhose I just updated the membership, should be public now! I didn't know this visibility could be changed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants