Re: initdb SegFault - Mailing list pgsql-hackers

From Tom Lane
Subject Re: initdb SegFault
Date
Msg-id 19334.1574183210@sss.pgh.pa.us
Whole thread Raw
In response to Re: initdb SegFault  (Andres Freund <andres@anarazel.de>)
Responses Re: initdb SegFault  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> Agreed wrt this specific failure scenario. It does however seem not
> great that callsites for PQExpBuffer ought to check every call for
> allocation failures, in the general case.

It is possible to check just once at the end, using the PQExpBufferBroken
API, and I believe that libpq for instance is fairly careful about that.

I agree that programs that just need to print something and exit could
perhaps ask pqexpbuffer.c to handle that for them.  (But initdb still
doesn't fall in that category, because of its very nontrivial atexit
handler :-(.)

> I wonder if, for frontend paths, a simplified error handling path would
> be worthwhile for OOM paths. Doing only a write() or such to print an
> error message.

Perhaps.  You wouldn't get any translation --- but then, gettext is
probably going to fail anyway under such conditions.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: initdb SegFault
Next
From: Tom Lane
Date:
Subject: Re: Role membership and DROP