Error listening on topic "river_leadership"
I am using aws rds, postgres v17.
I get this issue randomnly and this gets fixed when i reboot the database, no other fixes works. Tried vacuum analyze, tried checking for the transaction it is stuck with, nothing worked. Please help
{"level":"fatal","file":"main.go","line":118,"error":"Failed to start River client: error listening on topic \"river_leadership\": ERROR: could not access status of transaction 830749165 (SQLSTATE 58P01)","time":"2025-07-03T07:50:44Z","message":"Failed to start River client: error listening on topic \"river_leadership\": ERROR: could not access status of transaction 830749165 (SQLSTATE 58P01)"}
Are you using a connection pooler like pgbouncer? The listener routine operates on full connections and doesn’t really do anything with transactions: https://github.com/riverqueue/river/blob/master/riverdriver/riverpgxv5/river_pgx_v5_driver.go#L953
Not using pgbouncer. Also narrowed down the root cause to this : https://postgrespro.com/list/thread-id/2546853#:~:text=The%20LISTEN/NOTIFY%20queue%20stores,TransactionId%20N%0Abackend%201%3A%20COMMIT
I don't think there is a solution to this right now, other than avoiding long transactions or frequent auto vacuum.