Re: Dead lock after the migration from CentOS 7 to RHEL 9

From: Asad Ali <asadalinagri(at)gmail(dot)com>
To: Wasim Devale <wasimd60(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Dead lock after the migration from CentOS 7 to RHEL 9
Date: 2024-08-15 06:43:22
Message-ID: CAJ9xe=sKGVNYow-PBbFCP766=-ehiw8e4QzrGHbuogb-V2aHcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

The error message indicates a deadlock situation between two processes in
your PostgreSQL database. A deadlock occurs when two or more processes are
blocked indefinitely, each waiting for the other to release a lock.

Here's a breakdown of the error message:

- Process 2197043 is waiting for an AccessExclusiveLock on relation
10384355 (a table or index).
- Process 1889236 is holding the lock that process 2197043 is waiting for
and is waiting for a RowExclusiveLock on relation 10168609 (another table
or index).
- Process 2197043 is holding the lock that process 1889236 is waiting for,
creating a deadlock.

*To resolve this issue:*
1. Check the server log for query details, as hinted in the error message.
This will help you identify the queries causing the deadlock.
2. Analyze the queries and identify any potential causes, such as:
- Long-running transactions
- Lock contention between multiple processes
- Poorly indexed tables

*3. Consider the following solutions:* - Optimize queries to reduce lock
contention
- Use more granular locking (e.g., RowShareLock instead of
RowExclusiveLock)
- Split long-running transactions into smaller ones
- Reindex tables during a maintenance window to minimize lock contention
4. If the issue persists, consider increasing the deadlock_timeout
parameter to allow PostgreSQL to detect and resolve deadlocks more
efficiently.

Remember to exercise caution when making changes to your database
configuration or queries, as they may impact performance or data integrity.

On Wed, Aug 14, 2024 at 10:39 AM Wasim Devale <wasimd60(at)gmail(dot)com> wrote:

> Hi All
>
> I am facing this issue while reindexing after migration. I analysed the
> application holding the particular table. I stopped the application and
> reindexed it. It went well then again I am facing this issue below.
>
> ERROR: deadlock detected
>
> DETAIL: Process 2197043 waits for AccessExclusiveLock on relation 10384355
> of database 10163711; blocked by process 1889236.
>
> Process 1889236 waits for RowExclusiveLock on relation 10168609 of
> database 10163711; blocked by process 2197043.
>
> HINT: See server log for query details.
>
>
> Thanks,
> Wasim
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Asad Ali 2024-08-15 07:36:07 Re: LIsten Errror
Previous Message Tom Lane 2024-08-15 04:08:28 Re: Dead lock after the migration from CentOS 7 to RHEL 9