Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fc3f445

Browse filesBrowse files
committed
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
1 parent f946069 commit fc3f445
Copy full SHA for fc3f445

File tree

Expand file treeCollapse file tree

2 files changed

+9
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-5
lines changed

‎src/backend/postmaster/postmaster.c

Copy file name to clipboardExpand all lines: src/backend/postmaster/postmaster.c
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4900,11 +4900,6 @@ SubPostmasterMain(int argc, char *argv[])
49004900
/* Close the postmaster's sockets (as soon as we know them) */
49014901
ClosePostmasterPorts(strcmp(argv[1], "--forklog") == 0);
49024902

4903-
/*
4904-
* Set reference point for stack-depth checking
4905-
*/
4906-
set_stack_base();
4907-
49084903
/*
49094904
* Set up memory area for GSS information. Mirrors the code in ConnCreate
49104905
* for the non-exec case.

‎src/backend/utils/init/miscinit.c

Copy file name to clipboardExpand all lines: src/backend/utils/init/miscinit.c
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ InitPostmasterChild(void)
9292
{
9393
IsUnderPostmaster = true; /* we are a postmaster subprocess now */
9494

95+
/*
96+
* Set reference point for stack-depth checking. We re-do that even in the
97+
* !EXEC_BACKEND case, because there are some edge cases where processes
98+
* are started with an alternative stack (e.g. starting bgworkers when
99+
* running postgres using the rr debugger, as bgworkers are launched from
100+
* signal handlers).
101+
*/
102+
set_stack_base();
103+
95104
InitProcessGlobals();
96105

97106
/*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.