Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ27p-0004pK-62 for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Aug 2022 07:45:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oQ27o-00075M-1P for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Aug 2022 07:45:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ27n-00075D-Mq for pgsql-bugs@lists.postgresql.org; Mon, 22 Aug 2022 07:45:31 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oQ27j-0004xC-Ji for pgsql-bugs@lists.postgresql.org; Mon, 22 Aug 2022 07:45:31 +0000 Received: by mail-pj1-x1044.google.com with SMTP id g18so10163188pju.0 for ; Mon, 22 Aug 2022 00:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc; bh=DGgIC+TeNW5WBHuwffJ94sxDI1oCPJtUy3e0lW2cIAo=; b=EWdlh2eqcvWDH2LwynSFBC7/w9Eta/UfSogn/lrzkGgqOCBGXK1HKCbQBnG9MZx420 8gwzkX3obqXPxMysECpTCba2A4XBAUI0KuDVVcZadP6IuMRNAbxY79EgNmgCLs4DRENO LhKryz5v4NuJ7kFb/VTCvPbhfGwtItTPPAg1MMCeplfAjyWy5+rlNgajRFY5Y0AJUTKa uheYst6KYwwnNjBiFJfwzS4b8wUeKLvAPFH28ezLdDPKA3amRCm8fUaluOJEQCXnE6Wd eCTIoYDj2sEK8KZnIoq7sjkJDgH93RBnFmS+uqyHPqUytTVlsu41D94blXHCL5DhyT4Q 7q0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:subject:references:in-reply-to:message-id:to:from:date :x-gm-message-state:from:to:cc; bh=DGgIC+TeNW5WBHuwffJ94sxDI1oCPJtUy3e0lW2cIAo=; b=vwl/A9h3wKp5KrW0OgmKC0K1o4PJwuFgu9absDRATzHKa4vfK4TqcSE9fBjhgrhzSW dDQ3nJinMORck8BsPU/lXIM6wJWJjwl1Hi40zPRXtAHEPn4PtwYOgEqaU0XAYbrSFuAW ps+DvaMlgCPTsI1loLOGIpa0HjtWx+jCyQ6P1ySdNQhlkH4966S0Pd5ePIer4Ua94ZwW 29YbNO0hSz5Wn4asnZo+UeFtTSTT1v7ZEUZwuHVAdXQPbNB0HMqYcos+cOYgj0iUCK8d itec6DLS+tSfg9HQU23cR0hN5bTjBbxLmHKIO39VnvlzTojgnod5SmSzPwKR+LZZ2fxN 3HFg== X-Gm-Message-State: ACgBeo382UozGKLseraCb+CgJhareRzUfQsyIXYtOihwxLruvnBSBmnJ 0DGQgSx7ZUFvWRpFJPxS9PY= X-Google-Smtp-Source: AA6agR7T3wkPSpuEafDTNWHiFJLrp6qcTXeoV12a9F5yRiWHXYHC0R0ECRlPo46Se5NyI1dPDqa/Lw== X-Received: by 2002:a17:90b:17c8:b0:1f5:4724:981f with SMTP id me8-20020a17090b17c800b001f54724981fmr22096980pjb.205.1661154325612; Mon, 22 Aug 2022 00:45:25 -0700 (PDT) Received: from [198.18.47.138] ([104.223.86.8]) by smtp.gmail.com with ESMTPSA id z67-20020a623346000000b0052d46b43006sm7900127pfz.156.2022.08.22.00.45.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Aug 2022 00:45:25 -0700 (PDT) Date: Mon, 22 Aug 2022 15:45:11 +0800 From: Zhang Mingli To: ma100@hotmail.com, pgsql-bugs@lists.postgresql.org Message-ID: <46726dc2-ca8c-426e-bb4e-cfa47ce48d9e@Spark> In-Reply-To: <17591-6ae23a6598b64c4e@postgresql.org> References: <17591-6ae23a6598b64c4e@postgresql.org> Subject: Re: BUG #17591: elog(ERROR) cause SharedSnapshotLock deadlock X-Readdle-Message-ID: 46726dc2-ca8c-426e-bb4e-cfa47ce48d9e@Spark MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="6303340c_60b6df70_1b7" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --6303340c_60b6df70_1b7 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, Didn=E2=80=99t see any bugs here, it report an error and the transaction = will end and release all resources. Regards, Zhang Mingli On Aug 22, 2022, 14:58 +0800, PG Bug reporting form , wrote: > The following bug has been logged on the website: > > Bug reference: 17591 > Logged by: ma liangzhu > Email address: ma100=40hotmail.com > PostgreSQL version: 14.5 > Operating system: centos7 > Description: > > in lock.c, we can see code Release lock before return , e.g. > > =60=60=60c > 996: LockAcquireExtended > =7B > LWLockAcquire(partitionLock, LW=5FEXCLUSIVE); > > proclock =3D SetupLockInTable( ); > if (=21proclock) > =7B > LWLockRelease(partitionLock); --- Release lock before return > ereport(ERROR,) > =7D > =7D > =60=60=60 > > bug we can see some code doesn't release the lock. Does it may cause > deadlock=3F > > =60=60=60c > LockRelease() > =7B > LWLockAcquire(partitionLock, LW=5FEXCLUSIVE); > > lock =3D locallock->lock; > if (=21lock) > =7B > lock =3D (LOCK *) hash=5Fsearch=5Fwith=5Fhash=5Fvalue( ); > if (=21lock) > 2126: elog(ERROR, =22failed to re-find shared lock object=22); -- exit > without release > =7D > =60=60=60 > --6303340c_60b6df70_1b7 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi,

Didn=E2=80=99t see any bugs here, it report an error and the transaction = will end and release all resources.

Regards,
Zhang Mingli
On Aug 22, 2022, 14:58 +0800, PG Bu= g reporting form <noreply=40postgresql.org>, wrote:
The following bug has been logged on the website:

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

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

=60=60=60c
996: LockAcquireExtended
=7B
LWLockAcquire(partitionLock, LW=5FEXCLUSIVE);

proclock =3D SetupLockInTable( );
if (=21proclock)
=7B
LWLockRelease(partitionLock); --- Release lock before return
ereport(ERROR,)
=7D
=7D
=60=60=60

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

=60=60=60c
LockRelease()
=7B
LWLockAcquire(partitionLock, LW=5FEXCLUSIVE);

lock =3D locallock->lock;
if (=21lock)
=7B
lock =3D (LOCK *) hash=5Fsearch=5Fwith=5Fhash=5Fvalue( );
if (=21lock)
2126: elog(ERROR, =22failed to re-find shared lock object=22); -- exit without release
=7D
=60=60=60

--6303340c_60b6df70_1b7--