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 1mIYjd-0000tQ-Vf for pgsql-committers@arkaria.postgresql.org; Tue, 24 Aug 2021 15:53:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mIYjZ-0007AX-VR for pgsql-committers@arkaria.postgresql.org; Tue, 24 Aug 2021 15:53:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIYjZ-0007AD-6z for pgsql-committers@lists.postgresql.org; Tue, 24 Aug 2021 15:53:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIYjS-0001QG-SB for pgsql-committers@lists.postgresql.org; Tue, 24 Aug 2021 15:53:03 +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 17OFqcha346519; Tue, 24 Aug 2021 11:52:38 -0400 From: Tom Lane To: Daniel Gustafsson cc: Peter Eisentraut , Fabien COELHO , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: psql: Add test for query canceling In-reply-to: <06B0EECD-BC76-4F57-BD49-ABEA17C41CC8@yesql.se> References: <5F16EBAA-30D3-4C0D-840C-C2FF2739E370@yesql.se> <1957503.1629485278@sss.pgh.pa.us> <1983764.1629499242@sss.pgh.pa.us> <973f7e4c-bf02-86f3-9909-988046b9362e@enterprisedb.com> <06B0EECD-BC76-4F57-BD49-ABEA17C41CC8@yesql.se> Comments: In-reply-to Daniel Gustafsson message dated "Tue, 24 Aug 2021 15:41:44 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <346517.1629820357.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 24 Aug 2021 11:52:38 -0400 Message-ID: <346518.1629820358@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Daniel Gustafsson writes: >> On 24 Aug 2021, at 15:40, Peter Eisentraut wrote: >> Thanks for looking into this. With your patch applied, tests 2, 3, and= 4 fail. Do they pass for you? > Thats odd, all tests pass for me. Did the logs give an indication as to= what > was failing? I also tried the patch. It passes for me on my Linux box, although it takes noticeably longer than before which doesn't seem great. On wrasse's host, it fails. The Perl log shows: ok 1 - PPID timer expired ok 2 - psql was signaled not ok 3 - query was canceled # Failed test 'query was canceled' # at t/020_cancel.pl line 50. # 'postgres=3D# SELECT pg_sleep(15); # Cancel request sent # ' # doesn't match '(?-xism:canceling statement due to user request)' ok 4 - Sleep query timer expired The postmaster log shows that the cancel was received and acted on: 2021-08-24 17:39:39.021 CEST [2178] LOG: database system is ready to acce= pt connections 2021-08-24 17:39:39.270 CEST [2187] 020_cancel.pl LOG: statement: SELECT = pg_sleep(15); 2021-08-24 17:39:42.407 CEST [2187] 020_cancel.pl ERROR: canceling statem= ent due to user request 2021-08-24 17:39:42.407 CEST [2187] 020_cancel.pl STATEMENT: SELECT pg_sl= eep(15); 2021-08-24 17:39:42.426 CEST [2178] LOG: received fast shutdown request so I'm not sure why the error message didn't make its way back to the client. Lack of pumping maybe? It's notable that there's not a lot of time elapsed between the cancel and the shutdown, according to the postmaster log, which says that we didn't wait for a timeout there. Anyway, I'm not terribly thrilled with the patch as-presented, because what I was hoping for was a test free of timing assumptions. This seems to be worse not better by that light. regards, tom lane