matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.83k stars 2.12k forks source link

621 - WARNING - persist_presence_changes-99641 - [TXN OPERROR] {update_presence-34728b} could not serialize access due to concurrent update #16734

Open lea-aglz opened 11 months ago

lea-aglz commented 11 months ago

Description

The are some Warnings on Synapse 1.89

Steps to reproduce

I have this error on the log.

Homeserver

auto-host

Synapse Version

1.89

Installation Method

pip (from PyPI)

Database

PosgreeSQL 11

Workers

Single process

Platform

CentOS7 VM Python installation

Configuration

No response

Relevant log output

2023-11-23 11:42:50.459 cd11-comm.on-gofast.com
2023-11-23 12:42:40,592 - synapse.storage.txn - 621 - WARNING - persist_presence_changes-99641 - [TXN OPERROR] {update_presence-34728b} could not serialize access due to concurrent update

Anything else that would be useful to know?

No response

DMRobertson commented 11 months ago

I think this is a specific instance of https://github.com/matrix-org/synapse/issues/4993.

This message is printed whenever we get an "operational error", in which case we rollback the transaction:

https://github.com/matrix-org/synapse/blob/ab3f1b3b53cdb4e2751b3e8c5eb052d7475be58f/synapse/storage/database.py#L777-L795

But the transaction will be retried (it lives within a loop that retries up to 5 times). This means that most of the time, these errors about concurrent access correct themsleves.

The specific example you highlight is

https://github.com/matrix-org/synapse/blob/9f514dd0fbf539d97b6d9f8f590aaf668fb3280e/synapse/storage/databases/main/presence.py#L128-L139

The comment and choice of isolation level seems to come from #15826, but it looks like it doesn't anticipate a concurrent update.