I recently encountered a strange error that I don't quite understand what could cause it:
caused by org.postgresql.util.PSQLException: ERROR: canceling statement due to conflict with recovery Detail: User was holding shared buffer pin for too long
.
I have a fixed timeout 10s set for each query, so any long run query should get terminated and the error message I expected to see User query get cancelled by user request
. However, I see this sometimes, but the above as well which is really confusing. Furthermore, it only show up when I see high lag from our RDS replica, then resolve itself after 5, 10 minutes.
I tried to reproduce this issue locally but no luck. Any thought would be greatly appreciated!
max_standby_archive_delay
. Given this is RDS, though, I'm not sure how applicable this is, or how easily you'll be able to debug it.