From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <stark@mit.edu>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: can we optimize STACK_DEPTH_SLOP
Date: Wed, 06 Jul 2016 09:34:49 -0400
Message-ID: <19108.1467812089@sss.pgh.pa.us> (raw)
In-Reply-To: <CAM-w4HN_U4CDuneDkXua4+Txhci5HNxkCRsCG78EkETzDQp-ZQ@mail.gmail.com>
References: <CAM-w4HMwwcwaVvYcAH0_FGtG5GeXdYVRfvG81pXnSJWHnCfosQ@mail.gmail.com>
<32729.1467734050@sss.pgh.pa.us>
<CA+TgmoYubk9mjX9Vjb7dki9JZWwoW-X5pLhwPaN=jv_MD9b_Sw@mail.gmail.com>
<28549.1467748100@sss.pgh.pa.us>
<CAM-w4HN_U4CDuneDkXua4+Txhci5HNxkCRsCG78EkETzDQp-ZQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Greg Stark <stark@mit.edu> writes:
> I did a similar(ish) test which is admittedly not as exhaustive as
> using pmap. I instrumented check_stack_depth() itself to keep track of
> a high water mark (and based on Robert's thought process) to keep
> track of the largest increment over the previous checked stack depth.
> This doesn't cover any cases where there's no check_stack_depth() call
> in the call stack at all (but then if there's no check_stack_depth
> call at all it's hard to see how any setting of STACK_DEPTH_SLOP is
> necessarily going to help).
Well, the point of STACK_DEPTH_SLOP is that we don't want to have to
put check_stack_depth calls in every function in the backend, especially
not otherwise-inexpensive leaf functions. So the idea is for the slop
number to cover the worst-case call graph after the last function with a
check. Your numbers are pretty interesting, in that they clearly prove
we need a slop value of at least 40-50K, but they don't really show that
that's adequate.
I'm a bit disturbed by the fact that you seem to be showing maximum
measured depth for the non-outlier tests as only around 40K-ish.
That doesn't match up very well with my pmap results, since in no
case did I see a physical stack size below 188K.
[ pokes around for a little bit... ] Oh, this is interesting: it looks
like the *postmaster*'s stack size is 188K, and of course every forked
child is going to inherit that as a minimum stack depth. What's more,
pmap shows stack sizes near that for all my running postmasters going back
to 8.4. But 8.3 and before show a stack size of 84K, which seems to be
some sort of minimum on this machine; even a trivial "cat" process has
that stack size according to pmap.
Conclusion: something we did in 8.4 greatly bloated the postmaster's
stack space consumption, to the point that it's significantly more than
anything a normal backend does. That's surprising and scary, because
it means the postmaster is *more* exposed to stack SIGSEGV than most
backends. We need to find the cause, IMO.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, stark@mit.edu, robertmhaas@gmail.com
Subject: Re: can we optimize STACK_DEPTH_SLOP
In-Reply-To: <19108.1467812089@sss.pgh.pa.us>
References: <CAM-w4HMwwcwaVvYcAH0_FGtG5GeXdYVRfvG81pXnSJWHnCfosQ@mail.gmail.com> <32729.1467734050@sss.pgh.pa.us> <CA+TgmoYubk9mjX9Vjb7dki9JZWwoW-X5pLhwPaN=jv_MD9b_Sw@mail.gmail.com> <28549.1467748100@sss.pgh.pa.us> <CAM-w4HN_U4CDuneDkXua4+Txhci5HNxkCRsCG78EkETzDQp-ZQ@mail.gmail.com> <19108.1467812089@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