element-hq / element-hq/synapse
Synapse gets stuck after seeing `psycopg2.errors.ReadOnlySqlTransaction: cannot execute nextval() in a read-only transaction`
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#16490](https://github.com/matrix-org/synapse/issues/16490).
---
https://github.com/matrix-org/synapse/blob/166ffc0f23419bc99d9597fe95deaae3bbee7caf/synapse/rest/health.py#L29-L31
Hi :)
It seems like the health endpoint is a little too simple. For example, I am getting with patroni (pg cluster) sometimes synapse in a state where it gets stuck in a read-only transaction state `psycopg2.errors.ReadOnlySqlTransaction: cannot execute nextval() in a read-only transaction`. Synapse never recovers until a restart from this, even when the database is already healthy for hours again. Meanwhile, however, my Kubernetes which could have easily restarted synapse by now thinks the server is healthy while all api endpoints fail.
Would it be possible to include fatal errors from the database in the evaluation of the health endpoint? Or are there other suggestions on how to solve this for someone hosting a synapse server?
Contributor guide
Assessment
This issue has not been assessed yet.