Cancelled query due to buffer deadlock with recovery - Mailing list pgsql-general

From Will Storey
Subject Cancelled query due to buffer deadlock with recovery
Date
Msg-id Z1Y8_q_q41S8AKIF@dev.null
Whole thread Raw
List pgsql-general
Hello!

I am running Postgres 16.6 on a primary and several standby servers. I
recently observed 3 queries being cancelled with this error:

ERROR: canceling statement due to conflict with recovery (SQLSTATE 40P01)

There was this detail with the error:

User transaction caused buffer deadlock with recovery

The standbys have hot_standby_feedback=on and
max_standby_streaming_delay=1min.

As far as I can tell, there were no long running transactions at the time
on either the primary or the standby in question. I did not see any
replication delay according to monitoring.

The queries that were cancelled were reading catalog tables - pg_inherits
joined with pg_class. I typically expect them to complete quickly (they
have a 100ms statement timeout).

I understand that canceling due to conflicts should be expected when using
hot standbys, but I'm struggling to understand why it happened in this
case.

What do you think?

Thank you!

Will



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Insert records in the tavke only if they are not exist
Next
From: "Joe Wildish"
Date:
Subject: pg_upgrade vs. logical replication