Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qNz3Z-006VA1-Fb for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jul 2023 17:09:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qNz3X-00C2gG-QA for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jul 2023 17:09:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qNz3X-00C2f8-G3 for pgsql-hackers@lists.postgresql.org; Mon, 24 Jul 2023 17:09:11 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qNz3U-0003fu-Mp for pgsql-hackers@postgresql.org; Mon, 24 Jul 2023 17:09:10 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3a3ad1f39ebso3590957b6e.1 for ; Mon, 24 Jul 2023 10:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neon-tech.20221208.gappssmtp.com; s=20221208; t=1690218547; x=1690823347; h=in-reply-to:references:from:to:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9geX/55gUHi9xxCHLCnU9/CJZJqFUdFoxQcV0ZSSHyU=; b=ei2uujm0eRBBrJNlWLqw149pWabDVsaUbFV2A+wODoepUoMPVjWJGZCcFL9lgTwKEX 15jC3buO9PeUeEDoMfE2OHsm+HdO6WWSyJB6MyviyQpma2Hl3QyB6zpuxhcmBZ/b6B5I lf9nbcdWGzRfgYh2xu7QVhccgZVrhkblSWeQ+rYFPjhjANTVPRxlJLjoMcEcaLSPssOD ebh1lsyPXzddWhldRdTI844JQTbhXPKLlx9AU5HqW8QnjPZd61eUr419DVKF8Zz1+dT3 nOm/yNB3Cv7dqKO2Z+bXfnNOGWC+/wQeyno62mFf5lWK3uglg8iAEFswPiZ9kpTzcX81 iepw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690218547; x=1690823347; h=in-reply-to:references:from:to:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9geX/55gUHi9xxCHLCnU9/CJZJqFUdFoxQcV0ZSSHyU=; b=DNUNvJP7qwzxRcTV2yvQA5oaD698iCudV4NA/gdz88xuT9yUK5ELp4ly4T13cNlLUZ A34QfUZN3ykHNOddgsMOYsZCujTJcoYe/RmUokgBnfWoUpJFzbjf6Afj0r17bkqJW+gD bWch1BgyYo8+g2vGbis09+JO0ukKYIdGGwRuVTYRIYrllAuFqUQ6RVoRjkMFCpqg/oQt poLzc8etoMs6Vt4n8eaX73yakz3W9C8rMEXJKMTgf2lxVCX2ue3f4PTG13wjH7BvKJus 50yd2Y00/QwQXSITovlWB0dBL98i5qO2cg/o4OWFeHgOyakDSxp1wPNpBTeoQSUzIl7c gqpw== X-Gm-Message-State: ABy/qLaeK8w62Gtj9d0qmP86rpZVcDYnONx7Xo28WnFizz805pd4aEXp 3JGAC4+wuiDh4YF0NI5kLwJJPZmbE+D7cRG/wck= X-Google-Smtp-Source: APBJJlGZn15p486+wx9RIbaJK5aN1ULIyQw74anjSRRiuN8sK2014Krb2eo5XRLz/fEn5Y05L4Bakg== X-Received: by 2002:a05:6808:d4a:b0:3a3:6456:efa6 with SMTP id w10-20020a0568080d4a00b003a36456efa6mr7914042oik.14.1690218546684; Mon, 24 Jul 2023 10:09:06 -0700 (PDT) Received: from localhost ([2607:fb91:12af:534d:3996:e070:71ee:42fb]) by smtp.gmail.com with ESMTPSA id a18-20020aca1a12000000b003a445b87eb8sm4284949oia.4.2023.07.24.10.09.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jul 2023 10:09:06 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed Date: Mon, 24 Jul 2023 12:09:05 -0500 Message-Id: Cc: Subject: Re: psql not responding to SIGINT upon db reconnection To: "Gurjeet Singh" From: "Tristan Partin" X-Mailer: aerc 0.15.2-105-g00bf476582f7 References: In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon Jul 24, 2023 at 12:00 PM CDT, Gurjeet Singh wrote: > On Mon, Jul 24, 2023 at 9:26=E2=80=AFAM Tristan Partin wrote: > > > attached patch > > + /* > + * Restore the default SIGINT behavior while within libpq. > Otherwise, we > + * can never exit from polling for the database connection. Fail= ure to > + * restore is non-fatal. > + */ > + newact.sa_handler =3D SIG_DFL; > + rc =3D sigaction(SIGINT, &newact, &oldact); > > There's no action taken if rc !=3D 0. It doesn't seem right to > continue as if everything's fine when the handler registration fails. > At least a warning is warranted, so that the user reports such > failures to the community. If we fail to go back to the default handler, then we just get the=20 behavior we currently have. I am not sure logging a message like "Failed=20 to restore default SIGINT handler" is that useful to the user. It isn't=20 actionable, and at the end of the day isn't going to affect them for the=20 most part. They also aren't even aware that default handler was ever=20 overridden in the first place. I'm more than happy to add a debug log if=20 it is the blocker to getting this patch accepted however. --=20 Tristan Partin Neon (https://neon.tech)