pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Jacob Champion <pchampion@vmware.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Daniel Gustafsson <daniel@yesql.se>
Subject: Re: [PATCH] Make jsonapi usable from libpq
Date: Wed, 30 Jun 2021 19:13:16 +0200
Message-ID: <bf828721-ef3e-2a8a-feeb-ade81a4b8f91@enterprisedb.com> (raw)
In-Reply-To: <3045186.1624729430@sss.pgh.pa.us>
References: <a250d475ba1c0cc0efb7dfec8e538fcc77cdcb8e.camel@vmware.com>
	<YNQedHwheUaTnnGt@paquier.xyz>
	<daeb22ec6ca8ef61e94d766a9b35fb03cabed38e.camel@vmware.com>
	<YNZ2mnsbDVJQrA/a@paquier.xyz>
	<3045186.1624729430@sss.pgh.pa.us>

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 <peter_e@gmx.net>
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.





view thread (21+ messages)  latest in thread

Message-ID: <bf828721-ef3e-2a8a-feeb-ade81a4b8f91@enterprisedb.com>
Permalink:  ../bf828721-ef3e-2a8a-feeb-ade81a4b8f91@enterprisedb.com/
Also on:    postgresql.org/message-id/bf828721-ef3e-2a8a-feeb-ade81a4b8f91@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, tgl@sss.pgh.pa.us, michael@paquier.xyz, pchampion@vmware.com, daniel@yesql.se
  Subject: Re: [PATCH] Make jsonapi usable from libpq
  In-Reply-To: <bf828721-ef3e-2a8a-feeb-ade81a4b8f91@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox