Re: Printing backtrace of postgres processes - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Printing backtrace of postgres processes
Date
Msg-id 20210506191406.hwafwkr4gs2vougq@alap3.anarazel.de
Whole thread Raw
In response to Re: Printing backtrace of postgres processes  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Printing backtrace of postgres processes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

On 2021-05-06 14:38:51 -0400, Robert Haas wrote:
> On Wed, Feb 3, 2021 at 2:30 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > This point is entirely separate from the question of whether
> > triggering stack traces at inopportune moments could cause system
> > malfunctions, but that question is also not to be ignored.
> 
> That worries me too, although I have a hard time saying exactly why.
> If we call an OS-provided function called backtrace() and it does
> something other than generate a backtrace - e.g. makes the process seg
> fault, or mucks about with the values of global variables - isn't that
> just a bug in the OS? Do we have particular reasons to believe that
> such bugs are common? My own skepticism here is mostly based on how
> inconsistent debuggers are about being able to tell you anything
> useful, which makes me think that in a binary compiled with any
> optimization, the ability of backtrace() to do something consistently
> useful is also questionable. But that's a separate question from
> whether it's likely to cause any active harm.

I think that ship kind of has sailed with

commit 71a8a4f6e36547bb060dbcc961ea9b57420f7190
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date:   2019-11-08 15:44:20 -0300

    Add backtrace support for error reporting

we allow generating backtraces in all kind of places, including
e.g. some inside critical sections via backtrace_functions. I don't
think also doing so during interrupt processing is a meaningful increase
in exposed surface area?

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: use `proc->pgxactoff` as the value of `index` in `ProcArrayRemove()`
Next
From: Andres Freund
Date:
Subject: Re: Printing backtrace of postgres processes