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 1q18y3-0002wX-2e for pgsql-bugs@arkaria.postgresql.org; Mon, 22 May 2023 17:05:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q18y1-0003Qn-OD for pgsql-bugs@arkaria.postgresql.org; Mon, 22 May 2023 17:05: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 1q18y1-0003QM-8U for pgsql-bugs@lists.postgresql.org; Mon, 22 May 2023 17:05:05 +0000 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q18xw-001FAy-Jy for pgsql-bugs@lists.postgresql.org; Mon, 22 May 2023 17:05:03 +0000 Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-38c35975545so4529812b6e.1 for ; Mon, 22 May 2023 10:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neon-tech.20221208.gappssmtp.com; s=20221208; t=1684775100; x=1687367100; h=in-reply-to:references:from:subject:to:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8XfuJwJbWBoN6LF496Gtp1TCDfyMq8YXnf06HWKK3PY=; b=qfgOGcgLBGtZMESX/yBShg8NLkd2rqwlrlvMiFp1TJ0kMP849lja8IJuZpaTdamBbd oSz71K7fe5oevtLmn5jaQWGBYHNnMZW7fNMsA7HASekQNfRHnbIr5fjuMPkWLZ1qNe1j T60LDOpV2x2S6c30rpvRB6F18wwxODyO0jjaG+RIGG7BolBymSDq3Ly+ZZ9lVZJP5/XE 1n6Nk+aF01oRWT+hK0y9TMrxWq2LkqL4xfTbZCHSzeMEb/uHL6b7D5LwmCexLKkcT0W9 fn4fBO+fNl4+/d3zR2DpXw1qYO1Z/+zykgWkjvtIKcTC6F6NHW93qqFYuDKWwHfEhFWk Ip1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684775100; x=1687367100; h=in-reply-to:references:from:subject:to:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8XfuJwJbWBoN6LF496Gtp1TCDfyMq8YXnf06HWKK3PY=; b=b0EAe3nENCxrNT2LLbkdu4wMSZ8VpMbRTJWKivGypsSo67/sTgDNIha90hKIFwC2WD gMabOZe6aQDqgALg21EtiaZrcde6njNDiRZH7L/5fu0wdAmnR4weecGBTODQvmB9mYpS M2Jb9pTMiGboSY3jTq7ccLIjgzPN7+433u9XAfkRfRLTJBXTCRzg5Cdy3jYtRthCPK4g OibDOzRRkW2zI2iS3uO0jDLNwyUZAPleNcKN6UmUJc2XeXuhZH52nOH0A/kf6DEzf1+7 sdcqmquSIh8/tQvvvzAfEs2XevVXLrElYrb+T34CSIVGJMw1TlT3UuoGvePhV1ENLZd9 iv6w== X-Gm-Message-State: AC+VfDxYQKpvjFvzK6Ti/4UpR9nix9VpKrsVcdYHequHymcnQPbw/coH wdegWs1HoA96bQ+3nLmFZ0b2MQ== X-Google-Smtp-Source: ACHHUZ4PmBFAfOGlDohztJ10ZyYZ7gP+Fwq4Ng2nNrGL+Zhrhl/5Wrpq7+RNJQic7r4CSJS8cA2YOg== X-Received: by 2002:aca:210d:0:b0:396:25be:bb91 with SMTP id 13-20020aca210d000000b0039625bebb91mr6184595oiz.16.1684775099929; Mon, 22 May 2023 10:04:59 -0700 (PDT) Received: from localhost ([2607:fb90:e602:57ee:8a4:550b:a504:c1ba]) by smtp.gmail.com with ESMTPSA id q84-20020a4a3357000000b0054c9382b871sm2822463ooq.12.2023.05.22.10.04.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 May 2023 10:04:59 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 22 May 2023 12:04:58 -0500 Message-Id: To: "Alvaro Herrera" , , Subject: Re: BUG #17698: On SIGTERM, psql terminates, but leaves the statement running From: "Tristan Partin" X-Mailer: aerc 0.14.0 References: <17698-58a6ab8caec496b0@postgresql.org> <20230116151459.fzg6mlegkcrzch4i@alvherre.pgsql> In-Reply-To: <20230116151459.fzg6mlegkcrzch4i@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon Jan 16, 2023 at 9:14 AM CST, Alvaro Herrera wrote: > On 2022-Nov-25, PG Bug reporting form wrote: > > > Reproduction: start psql, launch a query that will take a while (I > > used 'select pg_sleep(1234)'), then from another terminal do > > "kill -TERM ". Psql would be terminated, but query would > > not be, and will keep running until TCP timeout kicks in and kills the > > stale connection. > >=20 > > SIGINT, on the other hand, will cause psql will terminate the current > > statement. > >=20 > > Perhaps psql could have a SIGTERM handler that does roughly what > > SIGINT handler does before terminating the whole process, and would > > cancel the current statement (if any)? > > Sure. I doubt we want to wait until a reply to the cancel request is > obtained, but we could have the sigterm handler at least send it before > terminating. I am currently working on a patch for this. --=20 Tristan Partin Neon (https://neon.tech)