Re: Lock timeout in commit - Mailing list pgsql-general

From Tom Lane
Subject Re: Lock timeout in commit
Date
Msg-id 1529239.1752161326@sss.pgh.pa.us
Whole thread Raw
In response to Lock timeout in commit  (Steve Baldwin <steve.baldwin@gmail.com>)
Responses Re: Lock timeout in commit
List pgsql-general
Steve Baldwin <steve.baldwin@gmail.com> writes:
> I'm occasionally seeing a lock timeout in a commit statement. For example:

> 2025-07-10 08:56:07.225 UTC,"b2bc_api","b2bcreditonline",23592,"
> 10.124.230.241:60648",686f8022.5c28,55,"COMMIT",2025-07-10 08:56:02
> UTC,3984/10729,676737574,ERROR,55P03,"canceling statement due to lock
> timeout",,,,,,"COMMIT",,,"098c62f7-bb76-4607-88da-120c6edee423","client
> backend",,-2835399305386018931

> Am I right in thinking this is likely due to a deferred foreign key
> constraint?

Plausible guess perhaps, although FKs don't normally need strong
locks.

> I couldn't see any obvious clue in the log. Is there somewhere
> else I can look?

I think all you could do is monitor the pg_locks view and hope to
catch the process in "waiting" state before it fails.

It occurs to me to wonder though if we couldn't provide more
context in the error about what lock is being waited for.

            regards, tom lane



pgsql-general by date:

Previous
From: "DINESH NAIR"
Date:
Subject: Re: PostgresSQL Setup error
Next
From: Mircea Cadariu
Date:
Subject: Re: analyze-in-stages post upgrade questions