-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/sync
fails with SynapseError: 404 - Could not find event
if the last event is a redaction of an event that we don't have
#12864
Comments
It's probably unrelated to SAML. Sounds similar to #12820, but it's hard to confirm because no one's posting their errors or logs. Could you dig out some INFO-level Synapse logs that include the 404 response to /sync? |
Yes, that should be possible. Tomorrow is a national holyday, so I will change the log level Friday morning and hopefully deliver logs Friday or Monday. |
Same error on my homeserver. Multiple users affected, the two I investigated a bit more have the following logs (renamed to "user1" and "user2" here):
Issue exists on Synapse 1.58.1 and 1.59.1 and on Element-Web 1.10.11, 1.10.12 and 1.10.13. Unsure if it already affected older versions. |
This sounds rather like #12571, but that should have been fixed in Synapse 1.59.0 (and later) :/ @rettichschnidi: can you run a query on your database and share the results? SELECT * FROM events e LEFT JOIN rejections r USING (event_id)
WHERE event_id='$vrNBlJ52sq9ojxXRFl7JLoBU1A5zyEorDuoMYMxkz8g'; |
/sync
fails with SynapseError: 404 - Could not find event
(user3 is another alias for a 3rd user) |
That's... odd. Can you check
|
|
hrm, another idea. Can you try these: SELECT * FROM redactions WHERE event_id='$vrNBlJ52sq9ojxXRFl7JLoBU1A5zyEorDuoMYMxkz8g';
SELECT * FROM redactions WHERE redacts='$vrNBlJ52sq9ojxXRFl7JLoBU1A5zyEorDuoMYMxkz8g'; |
|
right, and can you do the same queries for SELECT * FROM events e LEFT JOIN rejections r USING (event_id)
WHERE event_id='$ikN-_JY29tlFZpZ4oRzFPp7mRFR_UYWzDFLduvPSkO8';
SELECT event_id, internal_metadata FROM event_json
WHERE event_id='$ikN-_JY29tlFZpZ4oRzFPp7mRFR_UYWzDFLduvPSkO8'; (sorry, slightly grasping at straws here - I'm really struggling to understand what could cause that exception when the event is just there in the database) |
Not great for the documentation here, but in case it helps I am available on Matrix in either #synapse:matrix.org or via DM (@rettichschnidi:digitale-gesellschaft.ch). |
Maybe relevant details:
retention:
enabled: true
default_policy:
min_lifetime: 1d
max_lifetime: 90d
allowed_lifetime_min: 1d
allowed_lifetime_max: 90d
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Two more cleanup tasks I run once in a while on my home-server: #!/bin/bash
set -eu -o pipefail
# Remove all forgotten rooms
for room_id in $(curl -sS --header "Authorization: Bearer ZENSORED" --request GET 'http://localhost:8008/_synapse/admin/v1/rooms?limit=5000' | jq -r '.rooms[] | select(.joined_local_members == 0) | .room_id'); do
echo "Deleting room ${room_id}"
curl -sS --request POST --header "Authorization: Bearer ZENSORED" --header "Content-Type: application/json" --data "{ \"room_id\": \"$room_id\" }" 'http://localhost:8008/_synapse/admin/v1/purge_room' > /dev/null
done #!/bin/bash
set -eu -o pipefail
readonly auth_header="Authorization: Bearer censored"
declare -A purge_id_to_room_id
purge_ids=""
# Purge old history (90+ days) of all (well, up to 10'000) rooms
for room_id in $(curl -sS --header "${auth_header}" --request GET 'http://localhost:8008/_synapse/admin/v1/rooms?limit=10000' | jq -r '.rooms[] | .room_id'); do
# Delete history after 90 days
purge_id="$(curl -sS --request POST --header "${auth_header}" --header "Content-Type: application/json" --data "{ \"delete_local_events\": true, \"purge_up_to_ts\": $(( $(date +%s) - 86400 * 90))000 }" "http://localhost:8008/_synapse/admin/v1/purge_history/${room_id}" | jq -r .purge_id)"
if [ "${purge_id}" == null ]; then
echo "Failed to purge history of room '${room_id}'"
continue
fi
echo "Handle for purge_history of ${room_id}: ${purge_id}"
purge_ids="${purge_ids} ${purge_id}"
purge_id_to_room_id["${purge_id}"]="${room_id}"
done
while [ -n "${purge_ids// }" ]; do
echo "Left work: '${purge_ids/ /}'"
for purge_id in ${purge_ids}; do
progress="$(curl -sS --request GET --header "${auth_header}" --header 'Content-Type: application/json' "http://localhost:8008/_synapse/admin/v1/purge_history_status/${purge_id}")"
echo "State of ${purge_id_to_room_id[${purge_id}]}: ${progress}"
# Keep working on active purges
if echo "${progress}" | jq -e 'select(.status == "active")' > /dev/null; then
continue
fi
# Remove purges which are completed, failed no longer in database
purge_ids="${purge_ids//${purge_id}/}"
done
sleep 1
done However, both did not run around the time when the error started to show. Did run them today however. |
Right, I think I understand what is causing this now. It is related to #12571 in that it is because the sync token points to an event that cannot be retrieved from the database; however in this case the reason it cannot be retrieved is that it is a redaction which attempts to redact an event which we no longer have. |
/sync
fails with SynapseError: 404 - Could not find event
/sync
fails with SynapseError: 404 - Could not find event
if the last event is a redaction of an event that we don't have
(I hope this is also @n3rdybyn47ur3's problem - we have rather derailed this issue if not...) |
Seems plausible to me. I am also affected by this, which also point towards errors when events get deleted. Thanks a lot for your help! |
If you're feeling adventurous, the branch at #12905 should fix the problem. It's based on current bleeding-edge though. |
@richvdh I tried to apply the patches on top of 1.59.1 but (as you said) too much has changed since, so I gave up. In case having this tested would be very valuable I'll give it another try. |
I finally got hold of one of the users. Here are the corresponding log entries (IPs and usernames changed):
It seems to be the same problem as @rettichschnidi mentioned earlier. |
Just to add this: It seems I'm seeing the same problem. I'll try installing the RC that anoa said should be released tomorrow. Note that this will show up whenever an update of an Element app is installed, as the initial sync seems to trigger the problem. This is how it showed up on my end with the new version from TestFlight. So you might want to stall Element app releases until a fix is available in a regular release. |
Installing 1.61.0rc1 helped. |
Hello,
we noticed a strange login behaviour that only happens to some of our users:
When trying to log in (SAML) they got an 404 error after the SAML Authentication is allready completed (and the verification should start)
There are warnings to cachebuster GET requests in my synapse log:
2022-05-24 12:35:33,568 - synapse.http.server - 723 - WARNING - GET-125345 - Not sending response to request <XForwardedForRequest at 0x7fe7c3c40d00 method='GET' uri='/_matrix/client/r0/sync?filter=0&timeout=0&_cacheBuster=1653395733090' clientproto='HTTP/1.0' site='8008'>, already disconnected.
Sadly I could not find the coresponding one.
We have updated synapse more than once during the last weeks but since existing sessions reconnect without login its impossible to say, since when this happens. Most of the users can login fine. The problem occurs with Element Web, Desktop and Android App (all newest version.
The text was updated successfully, but these errors were encountered: