BUG #17591: elog(ERROR) cause SharedSnapshotLock deadlock - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17591: elog(ERROR) cause SharedSnapshotLock deadlock
Date
Msg-id 17591-6ae23a6598b64c4e@postgresql.org
Whole thread Raw
Responses Re: BUG #17591: elog(ERROR) cause SharedSnapshotLock deadlock
Re: BUG #17591: elog(ERROR) cause SharedSnapshotLock deadlock
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17591
Logged by:          ma liangzhu
Email address:      ma100@hotmail.com
PostgreSQL version: 14.5
Operating system:   centos7
Description:

in lock.c, we can see code  Release lock before return    , e.g.

```c
996: LockAcquireExtended
{ 
    LWLockAcquire(partitionLock, LW_EXCLUSIVE);
 
    proclock = SetupLockInTable( );
    if (!proclock)
    {     
        LWLockRelease(partitionLock);  --- Release lock before return     
        ereport(ERROR,)
    }
}
```

bug we can see some code doesn't release the lock. Does it may cause
deadlock?

```c
LockRelease()
{
    LWLockAcquire(partitionLock, LW_EXCLUSIVE);
 
    lock = locallock->lock;
    if (!lock)
    { 
        lock = (LOCK *) hash_search_with_hash_value( );
        if (!lock)
2126:            elog(ERROR, "failed to re-find shared lock object");  -- exit
without release
    }
```


pgsql-bugs by date:

Previous
From: Robins Tharakan
Date:
Subject: PANIC in heap_delete during ALTER TABLE
Next
From: jitesh tiwari
Date:
Subject: fetching bytea (blob) data of 850 MB from psql client failed