pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Berg <myon@debian.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>
Cc: torikoshia <torikoshia@oss.nttdata.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Printing backtrace of postgres processes
Date: Fri, 23 Feb 2024 16:39:47 +0100
Message-ID: <Zdi8Qy-32rSrhy_S@msg.df7cb.de> (raw)
In-Reply-To: <Zca-C0rND4V0ZWI6@paquier.xyz>
References: <ZcXeuOl9qy7YA9RH@paquier.xyz>
	<202402090848.j6evnpunbehe@alvherre.pgsql>
	<CAExHW5ugP_fAXtZhyES4zW5OtYn8J5e=eDZbSCCVM2ekASQRSg@mail.gmail.com>
	<Zca-C0rND4V0ZWI6@paquier.xyz>

Re: Michael Paquier
> >>        •  backtrace() and backtrace_symbols_fd() don't call malloc()  explic‐
> >>           itly,  but  they  are part of libgcc, which gets loaded dynamically
> >>           when first used.  Dynamic loading usually triggers a call  to  mal‐
> >>           loc(3).   If  you  need certain calls to these two functions to not
> >>           allocate memory (in signal handlers, for example), you need to make
> >>           sure libgcc is loaded beforehand.
> >>
> >> and the patch ensures that libgcc is loaded by calling a dummy
> >> backtrace() at the start of the process.
> 
> FWIW, anything I am reading about the matter freaks me out, including
> the dlopen() part in all the backends:
> https://www.gnu.org/software/libc/manual/html_node/Backtraces.html

I'd be concerned about the cost of doing that as part of the startup
of every single backend process. Shouldn't this rather be done within
the postmaster so it's automatically inherited by forked backends?
(EXEC_BACKEND systems probably don't have libgcc I guess.)

Christoph





view thread (135+ messages)  latest in thread

Message-ID: <Zdi8Qy-32rSrhy_S@msg.df7cb.de>
Permalink:  ../Zdi8Qy-32rSrhy_S@msg.df7cb.de/
Also on:    postgresql.org/message-id/Zdi8Qy-32rSrhy_S@msg.df7cb.de

 · 

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: myon@debian.org, michael@paquier.xyz, ashutosh.bapat.oss@gmail.com, alvherre@alvh.no-ip.org, bharath.rupireddyforpostgres@gmail.com, vignesh21@gmail.com, torikoshia@oss.nttdata.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Printing backtrace of postgres processes
  In-Reply-To: <Zdi8Qy-32rSrhy_S@msg.df7cb.de>

* 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