pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Julien Rouhaud <rjuju123@gmail.com>
Cc: Mats Kindahl <mats@timescale.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Use of signal-unsafe functions from signal handlers
Date: Tue, 24 May 2022 10:15:55 -0400
Message-ID: <1531973.1653401755@sss.pgh.pa.us> (raw)
In-Reply-To: <20220524123739.6glyxyx4owqpqjnr@jrouhaud>
References: <CA+14425wJh3m2XA4c8-stRKGQYLwKqFiScqZm7BBt1JxU2iU-g@mail.gmail.com>
	<20220524101418.7pp65powa362vzln@jrouhaud>
	<CA+14426Zpdi6=jr9Z+C_tzS36pVa_+BbCHSeriqd=sLw4X6_iw@mail.gmail.com>
	<20220524123739.6glyxyx4owqpqjnr@jrouhaud>

Julien Rouhaud <rjuju123@gmail.com> writes:
> Yes, but it's using ereport with FATAL level, so if it's the top level message
> the ErrorContext should be in initial state or have been reset previously, and
> if it's not then the escape hatch will reset the context.  So in any case there
> will be a guarantee to have at least 8kB available in that context, that any
> palloc will be able to use to format the message.

ereport() itself is just the tip of the iceberg; even if it's safe
(which I concur it isn't), there's also the atexit/on_proc_exit
functions that are likely to be called during shutdown.  So yeah,
this coding is not too safe.  I'm not sure that getting rid of it
would be a net win though, as we'd replace it-might-crash hazards
with it-might-never-exit hazards, from bgworkers that neglect to
respond to ShutdownRequestPending.

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <1531973.1653401755@sss.pgh.pa.us>
Permalink:  ../1531973.1653401755@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1531973.1653401755@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rjuju123@gmail.com, mats@timescale.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Use of signal-unsafe functions from signal handlers
  In-Reply-To: <1531973.1653401755@sss.pgh.pa.us>

* 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