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 1lydmC-0001U6-Eh for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jun 2021 17:13:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lydmB-000682-9O for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jun 2021 17:13:27 +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 1lydmA-00067t-B2 for pgsql-hackers@lists.postgresql.org; Wed, 30 Jun 2021 17:13:27 +0000 Received: from forward2-smtp.messagingengine.com ([66.111.4.226]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lydm5-00051n-SW for pgsql-hackers@postgresql.org; Wed, 30 Jun 2021 17:13:25 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 2BAC31940562; Wed, 30 Jun 2021 13:13:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 30 Jun 2021 13:13:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=PXxFdRUYMynv23RZGi3jSbhSyMfxEyWhVDlDgfbIF 80=; b=RCE/naXH+ZA6GQxYQbg/1tKXdQjLhr542/ECikh6OQ6jENme+3PhQlmCg CYzjWV/BS6adiRKWELzWrakGQt7e+UHZ3mSfSnTy6VgiZZ8A8ltuvMe+YXQDZO3p ybyKdD90QG7vSqB7FewBSN9jrVxxLk/zcHeoj636Biw0lUbUHCu+Pdi5b8i7oi1/ EGqlXdVhxsP3Rlc4bZKeyKc2FeDApxo6zI+1oVwhtfBqOs+Uj0IdPFlTybvHwdf4 rilCvxLOhKVgN3BiAYEv7pbtuo0sb35qLOyoY36eitb2AWm9scZE5a3BOr/bDEoC GD337LpgNj8A0nIBLX3zDF7TVtj1w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeigedgudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepleevheehueeiudeiteei tdekueetleefteejffeiffdugedvffdvffdtiedvueeknecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 30 Jun 2021 13:13:17 -0400 (EDT) Subject: Re: [PATCH] Make jsonapi usable from libpq To: Tom Lane , Michael Paquier Cc: Jacob Champion , "pgsql-hackers@postgresql.org" , Daniel Gustafsson References: <3045186.1624729430@sss.pgh.pa.us> From: Peter Eisentraut Message-ID: Date: Wed, 30 Jun 2021 19:13:16 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <3045186.1624729430@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 26.06.21 19:43, Tom Lane wrote: > I spent some time looking for other undesirable symbol dependencies > in libpq, and soon found a couple. PGTHREAD_ERROR potentially calls > abort(), which seems even worse than exit-on-OOM, although I don't > think we've ever heard a report of that being hit. Also, > fe-print.c's handling of OOM isn't nice at all: > > fprintf(stderr, libpq_gettext("out of memory\n")); > abort(); > > Although fe-print.c is semi-deprecated, it still seems like it'd > be a good idea to clean that up. These abort() calls were put there on purpose by: commit c6ea8ccea6bf23501962ddc7ac9ffdb99c8643e1 Author: Peter Eisentraut Date: Mon Jan 30 20:34:00 2012 Use abort() instead of exit() to abort library functions In some hopeless situations, certain library functions in libpq and libpgport quit the program. Use abort() for that instead of exit(), so we don't interfere with the normal exit codes the program might use, we clearly signal the abnormal termination, and the caller has a chance of catching the termination. This was originally pointed out by Debian's Lintian program. I don't object to refining this, but I think it is a mischaracterization to calls this kind of code wrong. And I'm dubious about the backpatching.