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

Extraneous requests for already-known events during client pagination (SYN-560) #1453

Closed
matrixbot opened this issue Dec 21, 2015 · 4 comments
Labels
z-bug (Deprecated Label)

Comments

@matrixbot
Copy link
Member

A sytest test observes that synapse makes extraneous /event/:event_id requests for events it is known at that time to already have, when the client makes a pagination request.

More specifically, when the client calls /messages at
https://github.com/matrix-org/sytest/blob/8511ea309840ee03403f3d73f5178d80362f6610/tests/50federation/34room-backfill.pl#L78

the Synapse-Under-Test has already been told the m.room.create and m.room.member event for the creator, as part of the /send_join response. Additionally, by inspecting its sqlite database just before it makes that call, those events do indeed appear in the file. However, by running this test, the SUT is observed to make two /event/ requests over federation with the event IDs of these very two events anyway.

(Imported from https://matrix.org/jira/browse/SYN-560)

(Reported by @leonerd)

@matrixbot
Copy link
Member Author

Jira watchers: @leonerd

@matrixbot
Copy link
Member Author

After some analysis, it seems to be getting slightly confused around synapse/handlers/federation.py lines 310 or so. It computes the list of "dangling edges" in the backfilled chunk response (which in our case is an empty set, because the backfill returns the entire history of the room, as it's so small). As this list of edges is empty, it doesn't manages to look up any existing auth events for the room. It then notices that it needs two, and makes outbound requests for them.

-- @leonerd

@matrixbot
Copy link
Member Author

matrixbot commented Dec 21, 2015

An initial fix for this bug is now pushed to the paul/SYN-560 branch. Still to be answered is what might happen if the backfill result doesn't contain the required event, but the local event database still did. I'm unclear currently whether that would therefore appear in the edges list and be picked up, or not.

-- @leonerd

@matrixbot matrixbot added the z-bug (Deprecated Label) label Nov 7, 2016
@matrixbot matrixbot changed the title Extraneous requests for already-known events during client pagination (SYN-560) Extraneous requests for already-known events during client pagination (https://github.com/matrix-org/synapse/issues/1453) Nov 7, 2016
@matrixbot matrixbot changed the title Extraneous requests for already-known events during client pagination (https://github.com/matrix-org/synapse/issues/1453) Extraneous requests for already-known events during client pagination (SYN-560) Nov 7, 2016
@richvdh
Copy link
Member

richvdh commented Dec 18, 2019

paul/SYN-560 was never merged but appears to have been superceded by #987, which I think fixed this bug.

This code has now been completely rewritten by #6526.

@richvdh richvdh closed this as completed Dec 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-bug (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

2 participants