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

POST /read_markers fails after history purge if cache is cleared #11738

@PiotrKozimor

Description

@PiotrKozimor

Description

POST /read_markers fails when event at which m.fully_read points is cleared using history purge.

Steps to reproduce

  1. have a two rooms with two users joined each
  2. type messages in Element in first room with first user
  3. switch to second room
  4. send new events with second user
  5. purge history up to latest event in a first room
  6. restart synapse so that cache is cleared
  7. on first user switch to previous room
  8. POST /read_marker FAILS with 404
  9. sending new message doesn't modify read marker

Looks like the only current workaround is to edit database manually :/ If synapse is not restarted, event is fetched from cache and read marker can be edited

$ curl --location --request POST 'https://hs.stg.globekeeper.com/_matrix/client/r0/rooms/!DZjumzOmWaqeeaDKtc:hs.stg.globekeeper.com/read_markers' \
--header 'Authorization: Bearer SECRET' \
--header 'Content-Type: application/json' \
--data-raw '{
  "m.fully_read": "$O8Mg-Vo5krkxojC1T0zf4q_h7k21s93qHbCnWVBFGAs"
}'
{"errcode":"M_UNKNOWN","error":"Could not find event $TV2s-Rsp0BWwTzWBHo-4FSCk-q0MAA5HfsHNi1ls4zo"}

m.fully_read points to non-existing event after history purge:

synapse1=# select * from room_account_data where user_id = '@tcayxbre:hs.stg.globekeeper.com' and room_id = '!DZjumzOmWaqeeaDKtc:hs.stg.globekeeper.com';
             user_id              |                  room_id                   | account_data_type | stream_id |                           content           | instance_name
----------------------------------+--------------------------------------------+-------------------+-----------+------------------------------------------------------------+---------------
 @tcayxbre:hs.stg.globekeeper.com | !DZjumzOmWaqeeaDKtc:hs.stg.globekeeper.com | m.fully_read      |      4051 | {"event_id":"$TV2s-Rsp0BWwTzWBHo-4FSCk-q0MAA5HfsHNi1ls4zo"} |
(1 row)
synapse1=# select * from events where event_id = '$TV2s-Rsp0BWwTzWBHo-4FSCk-q0MAA5HfsHNi1ls4zo';
 topological_ordering | event_id | type | room_id | content | unrecognized_keys | processed | outlier | depth | origin_server_ts | received_ts | sender | contains_url | instance_name | stream_ordering
----------------------+----------+------+---------+---------+-------------------+-----------+---------+-------+-----------------+-------------+--------+--------------+---------------+-----------------
(0 rows)

Version information

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-MajorMajor functionality / product severely impaired, no satisfactory workaround.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions