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 1otvbj-0007O8-N6 for pgsql-bugs@arkaria.postgresql.org; Sat, 12 Nov 2022 18:51:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1otvbi-0005h3-IZ for pgsql-bugs@arkaria.postgresql.org; Sat, 12 Nov 2022 18:51:58 +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 1otvbi-0005gm-9h for pgsql-bugs@lists.postgresql.org; Sat, 12 Nov 2022 18:51:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1otvbf-0007yK-3g for pgsql-bugs@lists.postgresql.org; Sat, 12 Nov 2022 18:51:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2ACIpqjv146791; Sat, 12 Nov 2022 13:51:52 -0500 From: Tom Lane To: Mike Adelson cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #17686: SELECT pg_advisory_lock(...) with low lock_timeout sometimes times out but the lock is acquired In-reply-to: References: <17686-fb1fa3870138e394@postgresql.org>,<63573.1668271677@sss.pgh.pa.us> Comments: In-reply-to Mike Adelson message dated "Sat, 12 Nov 2022 13:28:45 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <146789.1668279112.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sat, 12 Nov 2022 13:51:52 -0500 Message-ID: <146790.1668279112@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mike Adelson writes: > Glad to have the race condition confirmed. In my view the “real” fix > here would be to offer an advisory locking function that accepts a > timeout. How would that remove the low-level race condition? regards, tom lane