-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
lazy-loading behaviour for /sync
is incorrectly specified
#942
Comments
This is certainly not very clear.
Yes, this paragraph (as with the paragraph above it) is in the context of lazy-loading.
lazy-loading is enabled via a filter, but that's just a boolean flag. Which events are omitted or returned, once lazy-loading is enabled, is subject to a somewhat complicated algorithm,
Correct. Or rather, "the membership event for the sender of the event that was in force at the time of the event".
Whether the membership events are in the gap or not is immaterial. And no, a server cannot assume the client has a complete understanding of memberships at the
Where "penultimate sentence" is "This ensures that joins/leaves and profile changes which occur during the gap are not lost." ? This is a good question. I don't understand what bearing "membership events for events in the gap" has on "profile changes in the gap". This wording appears to come from matrix-org/matrix-spec-proposals#2106. I've asked @ara4n if he can clarify.
Yeah, this is unclear. It means "all state which has changed in the gap". |
I think this is a thinko: during a gap in a sync, we just need to know the membership events which have happened - not the membership events which relate to the events in the gap. |
/sync
is incorrectly specified
ok, so that makes this a spec bug rather than a clarification. I've updated the labels and subject accordingly. |
Possibly related: this entry in Synapse's sytest blocklist:
|
When researching on how to clarify this in the spec documentation, I see the first question hasn't been answered yet;
I encountered the same problem when I was working on converting lazy-loading-related sytests to complement. What exactly does "redundant" mean here? And via which "reference" does the server track this? Does the server track if member events have already been included into the timeline by the continuing |
Redundant means the server has already sent the current member event to the client in the past and knows it was delivered.
Conduit does this: In every sync we send some set of member events to the client. Conduit only marks these members as "staging" and associates it to the next batch token. Only when the client calls sync again with that token, those marked events are confirmed as delivered and written to the db. Conduit also does this for /messages by confirming the delivery when the client reuses the "from" token, but I have a feeling that clients do not like this. |
Also I noticed an Element bug where it says "You're previewing #room, want to join it?" even though I am in the room already. This might be an Element web bug. Does it assume that the server sends the user's own member event in an initial sync even when lazy loading? The spec says "the user’s own membership event is eligible for being considered redundant by the server" |
I must admit I'm still struggling to grok parts of this.
Does "full state of rooms is requested" include an initial /sync? I'm pretty sure that under Synapse's interpretation it does (see https://github.com/matrix-org/synapse/blob/v1.73.0/synapse/handlers/sync.py#L948-L953; The issue linked there (element-hq/element-web#7209) sounds very much like what @timokoesters mentions above and this discrepancy would indeed explain why he sees that error with Conduit. It makes some kind of sense: the only other plausible interpretation of "full state of rooms is requested" is that the client set the "full_state" flag, and it's not obvious to me why would we make an exception for that, and room joins, without extending the same exception to initial /sync. So, assuming the user's own membership event is not eligible for omission on initial /sync, when are they eligible for omission? One idea is that if we have a gappy (ie, However: note that synapse currently doesn't implement lazy-loading at all for incremental syncs, and it seems like clients depend on that behaviour to avoid bugs like element-hq/element-web#7211 (and I strongly suspect that omitting membership events in incremental syncs would introduce problems with device-list tracking for E2E). Given that, my inclination is to entirely remove the sentence about "the user's own membership event being eligible for being considered redundant" from the spec. |
I'm coming to the conclusion that lazy-loading for incremental syncs is unimplementable, as currently specced.
Maybe we should update the spec to tell servers not to do lazy-loading on non-full-state syncs? ("Full state syncs" are initial syncs, plus incremental syncs where we send the full state to the client; in particular when the user has joined the room since the last sync.) |
Link to problem area: https://spec.matrix.org/v1.1/client-server-api/#get_matrixclientv3sync
I'm having a hard time following the description of
/sync
's behaviour. In particular, the third paragraph:Points of confusion:
I'm not sure what "being considered redundant by the server" refers to.
"membership events for events in the gap" sounds like "all membership events which are in the gap" to me; it wasn't obvious to me that events "have" or "own" a membership event.
gap
, or can they predate the gap? Put differently, can the server assume the client has a complete understanding of memberships at thesince
token, if it given? (Is this the meaning of redundant in thefinalpenultimate sentence?)"Note that the default behaviour of
state
is to include all membership events".since
token?since
token?The text was updated successfully, but these errors were encountered: