| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> | 
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org | 
| Cc: | ma100(at)hotmail(dot)com | 
| Subject: | BUG #17591: elog(ERROR) cause SharedSnapshotLock deadlock | 
| Date: | 2022-08-22 06:23:59 | 
| Message-ID: | 17591-6ae23a6598b64c4e@postgresql.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
The following bug has been logged on the website:
Bug reference:      17591
Logged by:          ma liangzhu
Email address:      ma100(at)hotmail(dot)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
	}
```
| From | Date | Subject | |
|---|---|---|---|
| Next Message | jitesh tiwari | 2022-08-22 07:14:17 | fetching bytea (blob) data of 850 MB from psql client failed | 
| Previous Message | Robins Tharakan | 2022-08-22 04:02:48 | PANIC in heap_delete during ALTER TABLE |