mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Recompute stack base in forked postmaster children.
This is for the benefit of running postgres under the rr debugger. When using rr signal handlers running while a syscall is active use an alternative stack. As e.g. bgworkers are started from within signal handlers, the forked backend then has a different stack base than postmaster. Previously that subsequently lead to those processes triggering spurious "stack depth limit exceeded" errors. Discussion: https://postgr.es/m/20200327182217.ubrrl32lyfhxfwk5@alap3.anarazel.de
This commit is contained in:
parent
f946069e68
commit
fc3f4453a2
@ -4900,11 +4900,6 @@ SubPostmasterMain(int argc, char *argv[])
|
|||||||
/* Close the postmaster's sockets (as soon as we know them) */
|
/* Close the postmaster's sockets (as soon as we know them) */
|
||||||
ClosePostmasterPorts(strcmp(argv[1], "--forklog") == 0);
|
ClosePostmasterPorts(strcmp(argv[1], "--forklog") == 0);
|
||||||
|
|
||||||
/*
|
|
||||||
* Set reference point for stack-depth checking
|
|
||||||
*/
|
|
||||||
set_stack_base();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up memory area for GSS information. Mirrors the code in ConnCreate
|
* Set up memory area for GSS information. Mirrors the code in ConnCreate
|
||||||
* for the non-exec case.
|
* for the non-exec case.
|
||||||
|
@ -92,6 +92,15 @@ InitPostmasterChild(void)
|
|||||||
{
|
{
|
||||||
IsUnderPostmaster = true; /* we are a postmaster subprocess now */
|
IsUnderPostmaster = true; /* we are a postmaster subprocess now */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set reference point for stack-depth checking. We re-do that even in the
|
||||||
|
* !EXEC_BACKEND case, because there are some edge cases where processes
|
||||||
|
* are started with an alternative stack (e.g. starting bgworkers when
|
||||||
|
* running postgres using the rr debugger, as bgworkers are launched from
|
||||||
|
* signal handlers).
|
||||||
|
*/
|
||||||
|
set_stack_base();
|
||||||
|
|
||||||
InitProcessGlobals();
|
InitProcessGlobals();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user