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 1n7V36-0006oe-St for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Jan 2022 04:15:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7V35-0000O7-00 for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Jan 2022 04:15:47 +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 1n7V34-0000Ny-Mr for pgsql-hackers@lists.postgresql.org; Wed, 12 Jan 2022 04:15:46 +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 1n7V2x-0005ka-Ty for pgsql-hackers@postgresql.org; Wed, 12 Jan 2022 04:15:45 +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 20C4FTdw2937815; Tue, 11 Jan 2022 23:15:29 -0500 From: Tom Lane To: Jelte Fennema cc: Andres Freund , Fujii Masao , Zhihong Yu , "pgsql-hackers@postgresql.org" Subject: Re: [EXTERNAL] Re: PQcancel does not use tcp_user_timeout, connect_timeout and keepalive settings In-reply-to: <2918809.1641947968@sss.pgh.pa.us> References: <1473763.1636578406@sss.pgh.pa.us> <20220105184225.5xfekapzg5o3uq7a@alap3.anarazel.de> <794237.1641408889@sss.pgh.pa.us> <2912315.1641943641@sss.pgh.pa.us> <2918809.1641947968@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 11 Jan 2022 19:39:28 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2937813.1641960929.1@sss.pgh.pa.us> Date: Tue, 11 Jan 2022 23:15:29 -0500 Message-ID: <2937814.1641960929@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ... btw, speaking of signal-safe functions: I am dismayed to notice that strerror (and strerror_r) are *not* in POSIX's list of async-signal-safe functions. This is really quite unsurprising, considering that they are chartered to return locale-dependent strings. Unless the data has already been collected in the current process, that'd imply reading something from the locale definition files, allocating memory to hold it, etc. So I'm now thinking this bit in PQcancel is completely unsafe: strncat(errbuf, SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)), maxlen); Seems we have to give up on providing any details beyond the name of the function that failed. regards, tom lane