Re: Printing backtrace of postgres processes

2024-02-26 Thread Michael Paquier
On Mon, Feb 26, 2024 at 04:05:05PM +0100, Christoph Berg wrote: > I tried that now. Mind that I'm not a benchmarking expert, and there's > been quite some jitter in the results, but I think there's a clear > trend. > > Even if we regard the 1873 as an outlier, I've seen many vanilla runs > with

Re: Printing backtrace of postgres processes

2024-02-26 Thread Christoph Berg
Re: Michael Paquier > Something like this can be measured with a bunch of concurrent > connections attempting connections and a very high rate, like pgbench > with an empty script and -C, for local connections. I tried that now. Mind that I'm not a benchmarking expert, and there's been quite some

Re: Printing backtrace of postgres processes

2024-02-23 Thread Michael Paquier
On Fri, Feb 23, 2024 at 04:39:47PM +0100, Christoph Berg wrote: > 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

Re: Printing backtrace of postgres processes

2024-02-23 Thread Christoph Berg
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‐ > >>

Re: Printing backtrace of postgres processes

2024-02-13 Thread Ashutosh Bapat
On Mon, Feb 12, 2024 at 6:52 AM Ashutosh Bapat wrote: > > > > > > We defer actual action triggered by a signal till CHECK_FOR_INTERRUPTS > > > is called. I understand that we can't do that here since we want to > > > capture the backtrace at that moment and can't wait till next CFI. But > > >

Re: Printing backtrace of postgres processes

2024-02-11 Thread Ashutosh Bapat
On Sat, Feb 10, 2024 at 5:36 AM Michael Paquier wrote: > > On Fri, Feb 09, 2024 at 02:27:26PM +0530, Ashutosh Bapat wrote: > > On Fri, Feb 9, 2024 at 2:18 PM Alvaro Herrera > > wrote: > >> Hmm, but the backtrace() manpage says > >> > >>• backtrace() and backtrace_symbols_fd() don't

Re: Printing backtrace of postgres processes

2024-02-09 Thread Michael Paquier
On Fri, Feb 09, 2024 at 02:27:26PM +0530, Ashutosh Bapat wrote: > On Fri, Feb 9, 2024 at 2:18 PM Alvaro Herrera wrote: >> Hmm, but the backtrace() manpage says >> >>• backtrace() and backtrace_symbols_fd() don't call malloc() explic‐ >> itly, but they are part of libgcc,

Re: Printing backtrace of postgres processes

2024-02-09 Thread Ashutosh Bapat
On Fri, Feb 9, 2024 at 2:18 PM Alvaro Herrera wrote: > > On 2024-Feb-09, Michael Paquier wrote: > > > Anyway, I've been digging around the signal-safety of backtrace(3) > > (even looking a bit at some GCC code, brrr), and I am under the > > impression that backtrace() is just by nature not safe

Re: Printing backtrace of postgres processes

2024-02-09 Thread Alvaro Herrera
On 2024-Feb-09, Michael Paquier wrote: > Anyway, I've been digging around the signal-safety of backtrace(3) > (even looking a bit at some GCC code, brrr), and I am under the > impression that backtrace() is just by nature not safe and also > dangerous in signal handlers. One example of issue

Re: Printing backtrace of postgres processes

2024-02-09 Thread Michael Paquier
On Thu, Feb 08, 2024 at 12:25:18PM +0900, Michael Paquier wrote: > In HandleLogBacktraceInterrupt(), we don't use backtrace_symbols() and > rely on backtrace_symbols_fd() to avoid doing malloc() in the signal > handler as mentioned in [1] back in 2022. Perhaps the part about the > fact that we

Re: Printing backtrace of postgres processes

2024-02-07 Thread Michael Paquier
On Thu, Feb 08, 2024 at 12:30:00AM +0530, Bharath Rupireddy wrote: > I've missed adding LoadBacktraceFunctions() in InitAuxiliaryProcess > for 0002 patch. Please find the attached v29 patch set. Sorry for the > noise. I've been torturing the patch with \watch and loops calling the function while

Re: Printing backtrace of postgres processes

2024-02-07 Thread Bharath Rupireddy
On Wed, Feb 7, 2024 at 9:00 PM Bharath Rupireddy wrote: > > On Wed, Feb 7, 2024 at 2:57 PM Michael Paquier wrote: > > > > On Wed, Feb 07, 2024 at 02:04:39PM +0530, Bharath Rupireddy wrote: > > > Well, that 'ubuntu' is the default username there, I've changed it now > > > and kept the output

Re: Printing backtrace of postgres processes

2024-02-07 Thread Bharath Rupireddy
On Wed, Feb 7, 2024 at 2:57 PM Michael Paquier wrote: > > On Wed, Feb 07, 2024 at 02:04:39PM +0530, Bharath Rupireddy wrote: > > Well, that 'ubuntu' is the default username there, I've changed it now > > and kept the output short. > > I would keep it just at two or three lines, with a "For

Re: Printing backtrace of postgres processes

2024-02-07 Thread Michael Paquier
On Wed, Feb 07, 2024 at 02:04:39PM +0530, Bharath Rupireddy wrote: > Well, that 'ubuntu' is the default username there, I've changed it now > and kept the output short. I would keep it just at two or three lines, with a "For example, with lines like": > I've simplified the tests, now we don't

Re: Printing backtrace of postgres processes

2024-02-07 Thread Bharath Rupireddy
On Tue, Feb 6, 2024 at 4:21 PM Michael Paquier wrote: > > --- a/src/backend/storage/ipc/procarray.c > +++ b/src/backend/storage/ipc/procarray.c > +bool > +SendProcSignalBackendOrAuxproc(int pid, ProcSignalReason reason) > +{ > > Looking at 0001. This API is a thin wrapper of SendProcSignal(),

Re: Printing backtrace of postgres processes

2024-02-06 Thread Michael Paquier
On Fri, Jan 26, 2024 at 11:58:00PM +0530, Bharath Rupireddy wrote: > You probably were looking at v21, the above change isn't there in > versions after that. Can you please review the latest version v26 > attached here? > > We might want this patch extended to the newly added walsummarizer >

Re: Printing backtrace of postgres processes

2024-01-26 Thread Bharath Rupireddy
On Fri, Jan 26, 2024 at 4:11 PM Alvaro Herrera wrote: > Thanks for reviewing. > > +You can get the file name and line number from the logged details by > > using > > +gdb/addr2line in linux platforms (users must ensure gdb/addr2line is > > +already installed). > > This doesn't read

Re: Printing backtrace of postgres processes

2024-01-26 Thread Alvaro Herrera
On 2022-Jan-27, vignesh C wrote: > diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml > index 0ee6974f1c..855ccc8902 100644 > --- a/doc/src/sgml/func.sgml > +++ b/doc/src/sgml/func.sgml > +You can get the file name and line number from the logged details by > using > +

Re: Printing backtrace of postgres processes

2024-01-25 Thread vignesh C
On Sun, 5 Nov 2023 at 01:49, Bharath Rupireddy wrote: > > On Thu, Jul 20, 2023 at 8:22 PM Daniel Gustafsson wrote: > > > > > On 11 Jan 2023, at 15:44, Bharath Rupireddy > > > wrote: > > > > > > On Wed, Nov 30, 2022 at 11:43 AM Bharath Rupireddy > > > wrote: > > >> > > >> I'm attaching the v22

Re: Printing backtrace of postgres processes

2024-01-14 Thread Maciek Sakrejda
The following review has been posted through the commitfest application: make installcheck-world: tested, failed Implements feature: tested, passed Spec compliant: not tested Documentation:tested, passed I'm not sure if this actually still needs review, but it's

Re: Printing backtrace of postgres processes

2023-11-04 Thread Bharath Rupireddy
On Thu, Jul 20, 2023 at 8:22 PM Daniel Gustafsson wrote: > > > On 11 Jan 2023, at 15:44, Bharath Rupireddy > > wrote: > > > > On Wed, Nov 30, 2022 at 11:43 AM Bharath Rupireddy > > wrote: > >> > >> I'm attaching the v22 patch set for further review. > > > > Needed a rebase due to

Re: Printing backtrace of postgres processes

2023-07-20 Thread Daniel Gustafsson
> On 11 Jan 2023, at 15:44, Bharath Rupireddy > wrote: > > On Wed, Nov 30, 2022 at 11:43 AM Bharath Rupireddy > wrote: >> >> I'm attaching the v22 patch set for further review. > > Needed a rebase due to 216a784829c2c5f03ab0c43e009126cbb819e9b2. > Attaching v23 patch set for further review.

Re: Printing backtrace of postgres processes

2023-01-11 Thread Bharath Rupireddy
On Wed, Nov 30, 2022 at 11:43 AM Bharath Rupireddy wrote: > > I'm attaching the v22 patch set for further review. Needed a rebase due to 216a784829c2c5f03ab0c43e009126cbb819e9b2. Attaching v23 patch set for further review. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source

Re: Printing backtrace of postgres processes

2022-11-29 Thread Bharath Rupireddy
On Fri, Nov 11, 2022 at 6:04 PM Bharath Rupireddy wrote: > > On Fri, Nov 11, 2022 at 7:59 AM Kyotaro Horiguchi > wrote: > > > > At Thu, 10 Nov 2022 15:56:35 +0530, Bharath Rupireddy > > wrote in > > > On Mon, Apr 18, 2022 at 9:10 AM vignesh C wrote: > > > > > > > > The attached v21 patch has

Re: Printing backtrace of postgres processes

2022-11-11 Thread Bharath Rupireddy
On Fri, Nov 11, 2022 at 7:59 AM Kyotaro Horiguchi wrote: > > At Thu, 10 Nov 2022 15:56:35 +0530, Bharath Rupireddy > wrote in > > On Mon, Apr 18, 2022 at 9:10 AM vignesh C wrote: > > > > > > The attached v21 patch has the changes for the same. > > > > Thanks for the patch. Here are some

Re: Printing backtrace of postgres processes

2022-11-10 Thread Kyotaro Horiguchi
At Thu, 10 Nov 2022 15:56:35 +0530, Bharath Rupireddy wrote in > On Mon, Apr 18, 2022 at 9:10 AM vignesh C wrote: > > > > The attached v21 patch has the changes for the same. > > Thanks for the patch. Here are some comments: > > 1. I think there's a fundamental problem with this patch, that

Re: Printing backtrace of postgres processes

2022-11-10 Thread Bharath Rupireddy
On Mon, Apr 18, 2022 at 9:10 AM vignesh C wrote: > > The attached v21 patch has the changes for the same. Thanks for the patch. Here are some comments: 1. I think there's a fundamental problem with this patch, that is, it prints the backtrace when the interrupt is processed but not when

Re: Printing backtrace of postgres processes

2022-04-17 Thread vignesh C
On Fri, Apr 15, 2022 at 11:49 AM Kyotaro Horiguchi wrote: > > At Thu, 14 Apr 2022 10:33:50 +0530, vignesh C wrote in > > On Wed, Apr 6, 2022 at 12:29 PM vignesh C wrote: > > > > > > On Tue, Apr 5, 2022 at 9:18 PM Robert Haas wrote: > > > > This looks like a grotty hack. > > > > > > I have

Re: Printing backtrace of postgres processes

2022-04-15 Thread Kyotaro Horiguchi
At Thu, 14 Apr 2022 10:33:50 +0530, vignesh C wrote in > On Wed, Apr 6, 2022 at 12:29 PM vignesh C wrote: > > > > On Tue, Apr 5, 2022 at 9:18 PM Robert Haas wrote: > > > This looks like a grotty hack. > > > > I have changed it so that the backtrace is set and returned to the > > caller. The

Re: Printing backtrace of postgres processes

2022-04-13 Thread vignesh C
On Wed, Apr 6, 2022 at 12:29 PM vignesh C wrote: > > On Tue, Apr 5, 2022 at 9:18 PM Robert Haas wrote: > > > > On Wed, Mar 30, 2022 at 12:03 PM Justin Pryzby wrote: > > > On Wed, Mar 30, 2022 at 11:53:52AM -0400, Greg Stark wrote: > > > > Sadly the cfbot is showing a patch conflict again. It's

Re: Printing backtrace of postgres processes

2022-04-06 Thread vignesh C
On Tue, Apr 5, 2022 at 9:18 PM Robert Haas wrote: > > On Wed, Mar 30, 2022 at 12:03 PM Justin Pryzby wrote: > > On Wed, Mar 30, 2022 at 11:53:52AM -0400, Greg Stark wrote: > > > Sadly the cfbot is showing a patch conflict again. It's just a trivial > > > conflict in the regression test schedule

Re: Printing backtrace of postgres processes

2022-04-05 Thread Robert Haas
On Wed, Mar 30, 2022 at 12:03 PM Justin Pryzby wrote: > On Wed, Mar 30, 2022 at 11:53:52AM -0400, Greg Stark wrote: > > Sadly the cfbot is showing a patch conflict again. It's just a trivial > > conflict in the regression test schedule so I'm not going to update > > the status but it would be

Re: Printing backtrace of postgres processes

2022-03-30 Thread Justin Pryzby
On Wed, Mar 30, 2022 at 11:53:52AM -0400, Greg Stark wrote: > Sadly the cfbot is showing a patch conflict again. It's just a trivial > conflict in the regression test schedule so I'm not going to update > the status but it would be good to rebase it so we continue to get > cfbot testing. Done.

Re: Printing backtrace of postgres processes

2022-03-30 Thread Greg Stark
Sadly the cfbot is showing a patch conflict again. It's just a trivial conflict in the regression test schedule so I'm not going to update the status but it would be good to rebase it so we continue to get cfbot testing.

Re: Printing backtrace of postgres processes

2022-03-11 Thread vignesh C
On Wed, Mar 9, 2022 at 9:26 PM Justin Pryzby wrote: > > rebased to appease cfbot. > > + couple of little fixes as 0002. Thanks for rebasing and fixing a few issues. I have taken all your changes except for mcxtfuncs changes as those changes were not done as part of this patch. Attached v19 patch

Re: Printing backtrace of postgres processes

2022-03-09 Thread Justin Pryzby
rebased to appease cfbot. + couple of little fixes as 0002. -- Justin >From 4be93f2bab460682a0f5af9e1e3f4970709b3517 Mon Sep 17 00:00:00 2001 From: Vigneshwaran C Date: Tue, 25 Jan 2022 08:21:22 +0530 Subject: [PATCH 1/2] Add function to log the backtrace of the specified postgres process.

Re: Printing backtrace of postgres processes

2022-01-30 Thread vignesh C
On Sat, Jan 29, 2022 at 8:06 AM vignesh C wrote: > > On Fri, Jan 28, 2022 at 1:54 PM Bharath Rupireddy > wrote: > > > > On Thu, Jan 27, 2022 at 10:45 AM vignesh C wrote: > > > > > > On Wed, Jan 26, 2022 at 11:07 AM Bharath Rupireddy > > > wrote: > > > > > > > > On Tue, Jan 25, 2022 at 12:00 PM

Re: Printing backtrace of postgres processes

2022-01-28 Thread vignesh C
On Fri, Jan 28, 2022 at 1:54 PM Bharath Rupireddy wrote: > > On Thu, Jan 27, 2022 at 10:45 AM vignesh C wrote: > > > > On Wed, Jan 26, 2022 at 11:07 AM Bharath Rupireddy > > wrote: > > > > > > On Tue, Jan 25, 2022 at 12:00 PM vignesh C wrote: > > > > Thanks for the comments, attached v17 patch

Re: Printing backtrace of postgres processes

2022-01-28 Thread Bharath Rupireddy
On Thu, Jan 27, 2022 at 10:45 AM vignesh C wrote: > > On Wed, Jan 26, 2022 at 11:07 AM Bharath Rupireddy > wrote: > > > > On Tue, Jan 25, 2022 at 12:00 PM vignesh C wrote: > > > Thanks for the comments, attached v17 patch has the fix for the same. > > > > Have a minor comment on v17: > > > >

Re: Printing backtrace of postgres processes

2022-01-26 Thread vignesh C
On Wed, Jan 26, 2022 at 11:07 AM Bharath Rupireddy wrote: > > On Tue, Jan 25, 2022 at 12:00 PM vignesh C wrote: > > Thanks for the comments, attached v17 patch has the fix for the same. > > Have a minor comment on v17: > > can we modify the elog(LOG, to new style ereport(LOG, ? > +

Re: Printing backtrace of postgres processes

2022-01-25 Thread Bharath Rupireddy
On Tue, Jan 25, 2022 at 12:00 PM vignesh C wrote: > Thanks for the comments, attached v17 patch has the fix for the same. Have a minor comment on v17: can we modify the elog(LOG, to new style ereport(LOG, ? + elog(LOG_SERVER_ONLY, "current backtrace:%s", errtrace.data); /*-- *

Re: Printing backtrace of postgres processes

2022-01-24 Thread vignesh C
On Mon, Jan 24, 2022 at 1:05 PM torikoshia wrote: > > On 2022-01-14 19:48, Bharath Rupireddy wrote: > > On Sat, Nov 20, 2021 at 11:50 AM Bharath Rupireddy > > wrote: > >> > >> On Fri, Nov 19, 2021 at 4:07 PM vignesh C wrote: > >> > The Attached v15 patch has the fixes for the same. > >> > >>

Re: Printing backtrace of postgres processes

2022-01-24 Thread vignesh C
On Mon, Jan 24, 2022 at 10:06 PM Fujii Masao wrote: > > > > On 2022/01/24 16:35, torikoshia wrote: > > On 2022-01-14 19:48, Bharath Rupireddy wrote: > >> On Sat, Nov 20, 2021 at 11:50 AM Bharath Rupireddy > >> wrote: > >>> > >>> On Fri, Nov 19, 2021 at 4:07 PM vignesh C wrote: > >>> > The

Re: Printing backtrace of postgres processes

2022-01-24 Thread Fujii Masao
On 2022/01/24 16:35, torikoshia wrote: On 2022-01-14 19:48, Bharath Rupireddy wrote: On Sat, Nov 20, 2021 at 11:50 AM Bharath Rupireddy wrote: On Fri, Nov 19, 2021 at 4:07 PM vignesh C wrote: > The Attached v15 patch has the fixes for the same. Thanks. The v15 patch LGTM and the cf bot

Re: Printing backtrace of postgres processes

2022-01-23 Thread torikoshia
On 2022-01-14 19:48, Bharath Rupireddy wrote: On Sat, Nov 20, 2021 at 11:50 AM Bharath Rupireddy wrote: On Fri, Nov 19, 2021 at 4:07 PM vignesh C wrote: > The Attached v15 patch has the fixes for the same. Thanks. The v15 patch LGTM and the cf bot is happy hence marking it as RfC. The

Re: Printing backtrace of postgres processes

2022-01-14 Thread Bharath Rupireddy
On Sat, Nov 20, 2021 at 11:50 AM Bharath Rupireddy wrote: > > On Fri, Nov 19, 2021 at 4:07 PM vignesh C wrote: > > The Attached v15 patch has the fixes for the same. > > Thanks. The v15 patch LGTM and the cf bot is happy hence marking it as RfC. The patch was not applying because of the recent

Re: Printing backtrace of postgres processes

2021-11-19 Thread Bharath Rupireddy
On Fri, Nov 19, 2021 at 4:07 PM vignesh C wrote: > The Attached v15 patch has the fixes for the same. Thanks. The v15 patch LGTM and the cf bot is happy hence marking it as RfC. Regards, Bharath Rupireddy.

Re: Printing backtrace of postgres processes

2021-11-19 Thread vignesh C
On Thu, Nov 18, 2021 at 9:52 PM Justin Pryzby wrote: > > On Wed, Nov 17, 2021 at 08:12:44PM +0530, vignesh C wrote: > > Attached v14 patch has the fixes for the same. > > Thanks for updating the patch. > > I cleaned up the docs and comments. I think this could be nearly "Ready". > > If you like

Re: Printing backtrace of postgres processes

2021-11-18 Thread Justin Pryzby
On Wed, Nov 17, 2021 at 08:12:44PM +0530, vignesh C wrote: > Attached v14 patch has the fixes for the same. Thanks for updating the patch. I cleaned up the docs and comments. I think this could be nearly "Ready". If you like the changes in my "fixup" patch (0002 and 0004), you should be able

Re: Printing backtrace of postgres processes

2021-11-17 Thread vignesh C
On Tue, Nov 16, 2021 at 1:12 AM Justin Pryzby wrote: > > On Mon, Nov 15, 2021 at 09:12:49PM +0530, vignesh C wrote: > > The idea here is to implement & expose pg_print_backtrace function, > > internally > > This patch is closely related to this one > https://commitfest.postgresql.org/35/3142/ >

Re: Printing backtrace of postgres processes

2021-11-15 Thread Bharath Rupireddy
On Tue, Nov 16, 2021 at 1:12 AM Justin Pryzby wrote: > > On Mon, Nov 15, 2021 at 09:12:49PM +0530, vignesh C wrote: > > The idea here is to implement & expose pg_print_backtrace function, > > internally > > This patch is closely related to this one > https://commitfest.postgresql.org/35/3142/ >

Re: Printing backtrace of postgres processes

2021-11-15 Thread Justin Pryzby
On Mon, Nov 15, 2021 at 09:12:49PM +0530, vignesh C wrote: > The idea here is to implement & expose pg_print_backtrace function, internally This patch is closely related to this one https://commitfest.postgresql.org/35/3142/ | Logging plan of the currently running query I suggest to review that

Re: Printing backtrace of postgres processes

2021-11-15 Thread vignesh C
On Mon, Nov 15, 2021 at 11:37 AM Dilip Kumar wrote: > > On Mon, Nov 15, 2021 at 10:34 AM vignesh C wrote: > > > > > Thanks for the comments, the attached v12 patch has the changes for the > > same. > > I have reviewed this patch and have some comments on v12-0001, > > 1. > +This feature

Re: Printing backtrace of postgres processes

2021-11-14 Thread Bharath Rupireddy
On Mon, Nov 15, 2021 at 12:08 PM Dilip Kumar wrote: > > > 2. > > > postgres[64154]=# select pg_print_backtrace(64136); > > > WARNING: 01000: PID 64136 is not a PostgreSQL server process > > > LOCATION: pg_print_backtrace, signalfuncs.c:335 > > > pg_print_backtrace > > > >

Re: Printing backtrace of postgres processes

2021-11-14 Thread Bharath Rupireddy
On Mon, Nov 15, 2021 at 12:13 PM vignesh C wrote: > > On Mon, Nov 15, 2021 at 11:00 AM Bharath Rupireddy > wrote: > > > > On Mon, Nov 15, 2021 at 10:34 AM vignesh C wrote: > > > > 2) I think "which is enough because the target process for logging of > > > > backtrace is a backend" isn't valid

Re: Printing backtrace of postgres processes

2021-11-14 Thread vignesh C
On Mon, Nov 15, 2021 at 11:00 AM Bharath Rupireddy wrote: > > On Mon, Nov 15, 2021 at 10:34 AM vignesh C wrote: > > > 2) I think "which is enough because the target process for logging of > > > backtrace is a backend" isn't valid anymore with 0002, righit? Please > > > remove it. > > > + * to

Re: Printing backtrace of postgres processes

2021-11-14 Thread Dilip Kumar
On Mon, Nov 15, 2021 at 11:53 AM Bharath Rupireddy wrote: > > On Mon, Nov 15, 2021 at 11:37 AM Dilip Kumar wrote: > > > > On Mon, Nov 15, 2021 at 10:34 AM vignesh C wrote: > > > > > > > > Thanks for the comments, the attached v12 patch has the changes for the > > > same. > > > > I have

Re: Printing backtrace of postgres processes

2021-11-14 Thread Bharath Rupireddy
On Mon, Nov 15, 2021 at 11:37 AM Dilip Kumar wrote: > > On Mon, Nov 15, 2021 at 10:34 AM vignesh C wrote: > > > > > Thanks for the comments, the attached v12 patch has the changes for the > > same. > > I have reviewed this patch and have some comments on v12-0001, > > 1. > +This feature

Re: Printing backtrace of postgres processes

2021-11-14 Thread Dilip Kumar
On Mon, Nov 15, 2021 at 10:34 AM vignesh C wrote: > > Thanks for the comments, the attached v12 patch has the changes for the same. I have reviewed this patch and have some comments on v12-0001, 1. +This feature is not supported for the postmaster, logger, checkpointer, +

Re: Printing backtrace of postgres processes

2021-11-14 Thread Bharath Rupireddy
On Mon, Nov 15, 2021 at 10:34 AM vignesh C wrote: > > 2) I think "which is enough because the target process for logging of > > backtrace is a backend" isn't valid anymore with 0002, righit? Please > > remove it. > > + * to call this function if we see PrintBacktracePending set. It is called > >

Re: Printing backtrace of postgres processes

2021-11-14 Thread vignesh C
On Mon, Nov 15, 2021 at 7:37 AM Bharath Rupireddy wrote: > > On Sun, Nov 14, 2021 at 8:49 PM vignesh C wrote: > > > 7) Do we need TAP tests for this function? I think it is sufficient to > > > test the function in misc_functions.sql, please remove > > > 002_print_backtrace_validation.pl. Note

Re: Printing backtrace of postgres processes

2021-11-14 Thread Bharath Rupireddy
On Sun, Nov 14, 2021 at 8:49 PM vignesh C wrote: > > 7) Do we need TAP tests for this function? I think it is sufficient to > > test the function in misc_functions.sql, please remove > > 002_print_backtrace_validation.pl. Note that we don't do similar TAP > > testing for

Re: Printing backtrace of postgres processes

2021-11-14 Thread vignesh C
On Fri, Nov 12, 2021 at 6:11 PM Bharath Rupireddy wrote: > > On Fri, Nov 12, 2021 at 5:15 PM Bharath Rupireddy > wrote: > > > > On Thu, Nov 11, 2021 at 12:14 PM vignesh C wrote: > > > Thanks for the comments, the attached v10 patch has the fixes for the > > > same. > > > > Thanks for the

Re: Printing backtrace of postgres processes

2021-11-14 Thread vignesh C
On Fri, Nov 12, 2021 at 5:15 PM Bharath Rupireddy wrote: > > On Thu, Nov 11, 2021 at 12:14 PM vignesh C wrote: > > Thanks for the comments, the attached v10 patch has the fixes for the same. > > Thanks for the patches. Here are some comments: > > 1) In the docs, let's have the similar

Re: Printing backtrace of postgres processes

2021-11-12 Thread Bharath Rupireddy
On Fri, Nov 12, 2021 at 5:15 PM Bharath Rupireddy wrote: > > On Thu, Nov 11, 2021 at 12:14 PM vignesh C wrote: > > Thanks for the comments, the attached v10 patch has the fixes for the same. > > Thanks for the patches. Here are some comments: > > 1) In the docs, let's have the similar

Re: Printing backtrace of postgres processes

2021-11-12 Thread Bharath Rupireddy
On Thu, Nov 11, 2021 at 12:14 PM vignesh C wrote: > Thanks for the comments, the attached v10 patch has the fixes for the same. Thanks for the patches. Here are some comments: 1) In the docs, let's have the similar description of pg_log_backend_memory_contexts for pg_print_backtrace, just for

Re: Printing backtrace of postgres processes

2021-11-10 Thread vignesh C
On Wed, Nov 10, 2021 at 12:17 PM Bharath Rupireddy wrote: > > On Tue, Nov 9, 2021 at 4:45 PM vignesh C wrote: > > Thanks for reporting this, the attached v9 patch has the changes for the > > same. > > Thanks for the v9 patch. I have some comments: > > 1) I think we are moving away from if

Re: Printing backtrace of postgres processes

2021-11-09 Thread Bharath Rupireddy
On Tue, Nov 9, 2021 at 4:45 PM vignesh C wrote: > Thanks for reporting this, the attached v9 patch has the changes for the same. Thanks for the v9 patch. I have some comments: 1) I think we are moving away from if (!superuser()) checks, see the commit [1]. The goal is to let the GRANT-REVOKE

Re: Printing backtrace of postgres processes

2021-11-09 Thread vignesh C
On Tue, Oct 12, 2021 at 10:47 AM bt21tanigaway wrote: > > Hi, > > > The previous patch was failing because of the recent test changes made > > by commit 201a76183e2 which unified new and get_new_node, attached > > patch has the changes to handle the changes accordingly. > > Thanks for your

Re: Printing backtrace of postgres processes

2021-11-09 Thread vignesh C
On Thu, Nov 4, 2021 at 4:06 PM Daniel Gustafsson wrote: > > > On 26 Aug 2021, at 16:56, vignesh C wrote: > > > The previous patch was failing because of the recent test changes made > > by commit 201a76183e2 which unified new and get_new_node, attached > > patch has the changes to handle the

Re: Printing backtrace of postgres processes

2021-11-04 Thread Daniel Gustafsson
> On 26 Aug 2021, at 16:56, vignesh C wrote: > The previous patch was failing because of the recent test changes made > by commit 201a76183e2 which unified new and get_new_node, attached > patch has the changes to handle the changes accordingly. This patch now fails because of the test changes

Re: Printing backtrace of postgres processes

2021-10-11 Thread bt21tanigaway
Hi, The previous patch was failing because of the recent test changes made by commit 201a76183e2 which unified new and get_new_node, attached patch has the changes to handle the changes accordingly. Thanks for your update! I have two comments. 1.Do we need “set_backtrace(NULL, 0);” on

Re: Printing backtrace of postgres processes

2021-08-26 Thread vignesh C
On Wed, Jul 21, 2021 at 10:56 PM vignesh C wrote: > > On Wed, Jul 21, 2021 at 3:52 PM Bharath Rupireddy > wrote: > > > > On Tue, Jul 13, 2021 at 9:03 PM vignesh C wrote: > > > > > > On Wed, May 12, 2021 at 2:27 AM Robert Haas wrote: > > > > > > > > Maybe we should have a role that is

Re: Printing backtrace of postgres processes

2021-07-21 Thread vignesh C
On Wed, Jul 21, 2021 at 3:52 PM Bharath Rupireddy < bharath.rupireddyforpostg...@gmail.com> wrote: > > On Tue, Jul 13, 2021 at 9:03 PM vignesh C wrote: > > > > On Wed, May 12, 2021 at 2:27 AM Robert Haas wrote: > > > > > > Maybe we should have a role that is specifically for server debugging > >

Re: Printing backtrace of postgres processes

2021-07-21 Thread Bharath Rupireddy
On Tue, Jul 13, 2021 at 9:03 PM vignesh C wrote: > > On Wed, May 12, 2021 at 2:27 AM Robert Haas wrote: > > > > Maybe we should have a role that is specifically for server debugging > > type things. This kind of overlaps with Mark Dilger's proposal to try > > to allow SET for security-sensitive

Re: Printing backtrace of postgres processes

2021-07-13 Thread vignesh C
On Wed, May 12, 2021 at 2:27 AM Robert Haas wrote: > > On Thu, May 6, 2021 at 3:31 PM Tom Lane wrote: > > Andres Freund writes: > > > On 2021-05-06 14:56:09 -0400, Tom Lane wrote: > > >> If we think it's worth having a predefined role for, OK. However, > > >> I don't like the future I see us

Re: Printing backtrace of postgres processes

2021-05-11 Thread Robert Haas
On Thu, May 6, 2021 at 3:31 PM Tom Lane wrote: > Andres Freund writes: > > On 2021-05-06 14:56:09 -0400, Tom Lane wrote: > >> If we think it's worth having a predefined role for, OK. However, > >> I don't like the future I see us heading towards where there are > >> hundreds of random

Re: Printing backtrace of postgres processes

2021-05-06 Thread Andres Freund
Hi, On 2021-05-06 15:22:02 -0400, Tom Lane wrote: > Andres Freund writes: > > we allow generating backtraces in all kind of places, including > > e.g. some inside critical sections via backtrace_functions. > > If there's an elog call inside a critical section, that seems > like a problem

Re: Printing backtrace of postgres processes

2021-05-06 Thread Andres Freund
Hi, On 2021-05-06 15:31:02 -0400, Tom Lane wrote: > I'd probably vote for pg_read_all_data, considering that much of > the concern about this has to do with the possibility of exposure > of sensitive data. I'm not quite sure what the security expectations > are for pg_monitor. I was wondering

Re: Printing backtrace of postgres processes

2021-05-06 Thread Tom Lane
Andres Freund writes: > On 2021-05-06 14:56:09 -0400, Tom Lane wrote: >> If we think it's worth having a predefined role for, OK. However, >> I don't like the future I see us heading towards where there are >> hundreds of random predefined roles. Is there an existing role >> that it'd be

Re: Printing backtrace of postgres processes

2021-05-06 Thread Tom Lane
Andres Freund writes: > On 2021-05-06 14:38:51 -0400, Robert Haas wrote: >> On Wed, Feb 3, 2021 at 2:30 AM Tom Lane 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

Re: Printing backtrace of postgres processes

2021-05-06 Thread Andres Freund
Hi, On 2021-05-06 14:56:09 -0400, Tom Lane wrote: > Robert Haas writes: > > On Wed, Feb 3, 2021 at 2:30 AM Tom Lane wrote: > >> TBH, I'm leaning to the position that this should be superuser > >> only. > > > I agree that ordinary users shouldn't be able to trigger it, but I > > think it should

Re: Printing backtrace of postgres processes

2021-05-06 Thread Andres Freund
Hi, On 2021-05-06 14:38:51 -0400, Robert Haas wrote: > On Wed, Feb 3, 2021 at 2:30 AM Tom Lane 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

Re: Printing backtrace of postgres processes

2021-05-06 Thread Tom Lane
Robert Haas writes: > On Wed, Feb 3, 2021 at 2:30 AM Tom Lane wrote: >> TBH, I'm leaning to the position that this should be superuser >> only. > I agree that ordinary users shouldn't be able to trigger it, but I > think it should be restricted to some predefined role, new or > existing, rather

Re: Printing backtrace of postgres processes

2021-05-06 Thread Robert Haas
On Wed, Feb 3, 2021 at 2:30 AM Tom Lane wrote: > A backtrace normally exposes the text of the current query, for > instance, which could contain very sensitive data (passwords in ALTER > USER, customer credit card numbers in ordinary data, etc etc). We > don't allow the postmaster log to be seen

Re: Printing backtrace of postgres processes

2021-05-06 Thread vignesh C
On Thu, May 6, 2021 at 7:43 AM Justin Pryzby wrote: > > Here's a cleaned-up copy of the doc text. > > Send a request to the backend with the specified process ID to log its > backtrace. > The backtrace will be logged at message level LOG. > It will appear in the server log based on the log

Re: Printing backtrace of postgres processes

2021-05-05 Thread Justin Pryzby
Here's a cleaned-up copy of the doc text. Send a request to the backend with the specified process ID to log its backtrace. The backtrace will be logged at message level LOG. It will appear in the server log based on the log configuration set (See for more information), but will not be sent to

Re: Printing backtrace of postgres processes

2021-05-05 Thread vignesh C
On Wed, Feb 3, 2021 at 3:24 PM Bharath Rupireddy wrote: > > On Wed, Feb 3, 2021 at 1:49 PM vignesh C wrote: > > > > On Wed, Feb 3, 2021 at 1:00 PM Tom Lane wrote: > > > > > > vignesh C writes: > > > > On Mon, Feb 1, 2021 at 11:04 AM Bharath Rupireddy > > > > wrote: > > > >> Are these

Re: Printing backtrace of postgres processes

2021-03-05 Thread torikoshia
On 2021-03-04 21:55, Bharath Rupireddy wrote: On Mon, Mar 1, 2021 at 10:43 AM torikoshia wrote: Since the current patch use BackendPidGetProc(), it does not support this feature not only postmaster, logging, and statistics but also checkpointer, background writer, and walwriter. And when I

Re: Printing backtrace of postgres processes

2021-03-04 Thread Bharath Rupireddy
On Mon, Mar 1, 2021 at 10:43 AM torikoshia wrote: > Since the current patch use BackendPidGetProc(), it does not > support this feature not only postmaster, logging, and > statistics but also checkpointer, background writer, and > walwriter. > > And when I specify pid of these PostgreSQL

Re: Printing backtrace of postgres processes

2021-02-28 Thread torikoshia
Hi, I also think this feature would be useful when supporting environments that lack debugger or debug symbols. I think such environments are not rare. + for more information. This +will help in identifying where exactly the backend process is currently +executing.

Re: Printing backtrace of postgres processes

2021-02-03 Thread Bharath Rupireddy
On Wed, Feb 3, 2021 at 1:49 PM vignesh C wrote: > > On Wed, Feb 3, 2021 at 1:00 PM Tom Lane wrote: > > > > vignesh C writes: > > > On Mon, Feb 1, 2021 at 11:04 AM Bharath Rupireddy > > > wrote: > > >> Are these superuser and permission checks enough from a security > > >> standpoint that we

Re: Printing backtrace of postgres processes

2021-02-03 Thread vignesh C
On Wed, Feb 3, 2021 at 1:00 PM Tom Lane wrote: > > vignesh C writes: > > On Mon, Feb 1, 2021 at 11:04 AM Bharath Rupireddy > > wrote: > >> Are these superuser and permission checks enough from a security > >> standpoint that we don't expose some sensitive information to the > >> user? > > >

Re: Printing backtrace of postgres processes

2021-02-02 Thread Tom Lane
vignesh C writes: > On Mon, Feb 1, 2021 at 11:04 AM Bharath Rupireddy > wrote: >> Are these superuser and permission checks enough from a security >> standpoint that we don't expose some sensitive information to the >> user? > This will just print the backtrace of the current backend. Users >

Re: Printing backtrace of postgres processes

2021-02-02 Thread vignesh C
On Mon, Feb 1, 2021 at 11:04 AM Bharath Rupireddy wrote: > > On Mon, Feb 1, 2021 at 6:14 AM Bharath Rupireddy > wrote: > > On Fri, Jan 29, 2021 at 7:10 PM vignesh C wrote: > > > > 4) How about following > > > > + errmsg("must be a superuser to print backtrace > > > > of

Re: Printing backtrace of postgres processes

2021-02-02 Thread vignesh C
Thanks Bharath for your comments. On Mon, Feb 1, 2021 at 6:14 AM Bharath Rupireddy wrote: > > On Fri, Jan 29, 2021 at 7:10 PM vignesh C wrote: > > > 4) How about following > > > + errmsg("must be a superuser to print backtrace > > > of backend process"))); > > > instead of >

Re: Printing backtrace of postgres processes

2021-02-01 Thread Dilip Kumar
On Fri, Jan 29, 2021 at 7:10 PM vignesh C wrote: > > Thanks Bharath for your review comments. Please find my comments inline below. > > On Thu, Jan 28, 2021 at 7:40 PM Bharath Rupireddy > wrote: > > > > On Thu, Jan 28, 2021 at 5:22 PM vignesh C wrote: > > > Thanks for the comments, I have fixed

Re: Printing backtrace of postgres processes

2021-02-01 Thread Kyotaro Horiguchi
At Fri, 29 Jan 2021 19:10:24 +0530, vignesh C wrote in > Attached v5 patch has the fixes for the same. PMSIGNAL_BACKTRACE_EMIT is not used anywhere? (the commit message seems stale.) +++ b/src/bin/pg_ctl/t/005_backtrace.pl pg_ctl doesn't (or no longer?) seem relevant to this patch. +

Re: Printing backtrace of postgres processes

2021-01-31 Thread Bharath Rupireddy
On Mon, Feb 1, 2021 at 6:14 AM Bharath Rupireddy wrote: > On Fri, Jan 29, 2021 at 7:10 PM vignesh C wrote: > > > 4) How about following > > > + errmsg("must be a superuser to print backtrace > > > of backend process"))); > > > instead of > > > +

Re: Printing backtrace of postgres processes

2021-01-31 Thread Bharath Rupireddy
On Fri, Jan 29, 2021 at 7:10 PM vignesh C wrote: > > 4) How about following > > + errmsg("must be a superuser to print backtrace > > of backend process"))); > > instead of > > + errmsg("must be a superuser to print backtrace > > of superuser query

  1   2   >