You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the alias writes occur on a separate worker to the reads, this is vulnerable to a classic worker cache invalidation race:
(2) succeeds because the reader has no cached alias information for the room. It queries the database (which is written before (1) completes) and caches the result.
(3) succeeds on the writer, which fires off a message telling readers to invalidate their caches.
⚠️ If request (4) arrives before the reader has received and processed the invalidation, the reader will return the (now stale) data in its cache. This means Alice has failed to read her own write.
I don't think actual humans edit and then immediately list aliases that often, so I suggest we don't worry about fixing this. (i.e. I think this only manifests as test flakes). But I wanted to write this up as a reference. (It would be nice to have a catalogue of known races like this).
matrixbot
changed the title
Dummy issue
Race condition with replication means that publishing room aliases lacks read-after-write consistency between workers
Dec 21, 2023
This issue has been migrated from #14210.
Consider the following sequence of events:
If the alias writes occur on a separate worker to the reads, this is vulnerable to a classic worker cache invalidation race:
I don't think actual humans edit and then immediately list aliases that often, so I suggest we don't worry about fixing this. (i.e. I think this only manifests as test flakes). But I wanted to write this up as a reference. (It would be nice to have a catalogue of known races like this).
History:
See issues labeled with https://github.com/matrix-org/synapse/labels/Z-Read-After-Write
And previous related history specifically around aliases:
GET /rooms/:room_id/aliases lists aliases
is broken matrix-org/sytest#1055 this causes a broken/flakey testGET_/rooms/:room_id/aliases_lists_aliases
matrix-org/synapse#14183 we notice the failures.GET /rooms/:room_id/aliases lists aliases
matrix-org/complement#521 readds the retry logicThe text was updated successfully, but these errors were encountered: