Skip to content

Commit 96112ee

Browse files
committed
Revert "Add some temporary code to record stack usage at server process exit."
This reverts commit 88cf37d as well as follow-on commits ea9c4a1 and c575627. We've learned about as much as we can from the buildfarm.
1 parent 30b2731 commit 96112ee

File tree

2 files changed

+0
-85
lines changed

2 files changed

+0
-85
lines changed

src/backend/storage/ipc/ipc.c

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
#include <signal.h>
2323
#include <unistd.h>
2424
#include <sys/stat.h>
25-
#if defined(__hpux)
26-
#include <sys/param.h>
27-
#include <sys/pstat.h>
28-
#endif
2925

3026
#include "miscadmin.h"
3127
#ifdef PROFILE_PID_DIR
@@ -35,9 +31,6 @@
3531
#include "storage/ipc.h"
3632
#include "tcop/tcopprot.h"
3733

38-
extern long max_measured_stack_depth;
39-
extern long max_measured_register_stack_depth;
40-
4134

4235
/*
4336
* This flag is set during proc_exit() to change ereport()'s behavior,
@@ -87,69 +80,6 @@ static int on_proc_exit_index,
8780
before_shmem_exit_index;
8881

8982

90-
/* Report process's stack consumption to stderr */
91-
static void
92-
report_stack_size(void)
93-
{
94-
#if defined(__hpux)
95-
/* HPUX: examine process's memory map with pstat_getprocvm() */
96-
int targetpid = getpid();
97-
int ndx;
98-
99-
for (ndx = 0;; ndx++)
100-
{
101-
struct pst_vm_status buf;
102-
const char *pagetype;
103-
int res;
104-
105-
res = pstat_getprocvm(&buf, sizeof(buf), targetpid, ndx);
106-
if (res < 0)
107-
{
108-
perror("getprocvm");
109-
break;
110-
}
111-
if (res != 1)
112-
break;
113-
switch (buf.pst_type)
114-
{
115-
case PS_STACK:
116-
pagetype = "STACK";
117-
break;
118-
#ifdef PS_RSESTACK
119-
case PS_RSESTACK:
120-
pagetype = "REGSTACK";
121-
break;
122-
#endif
123-
default:
124-
continue;
125-
}
126-
fprintf(stderr, "%d: stack addr 0x%lx, length %ld, physical pages %ld, type %s\n",
127-
targetpid,
128-
buf.pst_vaddr,
129-
buf.pst_length,
130-
buf.pst_phys_pages,
131-
pagetype);
132-
}
133-
#else /* non HPUX */
134-
/* Otherwise: try to use pmap. No error if that doesn't work. */
135-
char sysbuf[128];
136-
137-
snprintf(sysbuf, sizeof(sysbuf), "pmap -x %d | grep -i stack 1>&2",
138-
(int) getpid());
139-
(void) system(sysbuf);
140-
#endif
141-
142-
#if defined(__ia64__) || defined(__ia64)
143-
fprintf(stderr, "max measured stack depths %ldkB, %ldkB\n",
144-
(max_measured_stack_depth + 1023) / 1024,
145-
(max_measured_register_stack_depth + 1023) / 1024);
146-
#else
147-
fprintf(stderr, "max measured stack depth %ldkB\n",
148-
(max_measured_stack_depth + 1023) / 1024);
149-
#endif
150-
}
151-
152-
15383
/* ----------------------------------------------------------------
15484
* proc_exit
15585
*
@@ -171,9 +101,6 @@ proc_exit(int code)
171101
/* Clean up everything that must be cleaned up */
172102
proc_exit_prepare(code);
173103

174-
/* report stack size to stderr */
175-
report_stack_size();
176-
177104
#ifdef PROFILE_PID_DIR
178105
{
179106
/*

src/backend/tcop/postgres.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ int max_stack_depth = 100;
9696
/* wait N seconds to allow attach from a debugger */
9797
int PostAuthDelay = 0;
9898

99-
/* Exported for use by proc_exit */
100-
long max_measured_stack_depth = 0;
101-
long max_measured_register_stack_depth = 0;
10299

103100

104101
/* ----------------
@@ -3140,11 +3137,6 @@ stack_is_too_deep(void)
31403137
if (stack_depth < 0)
31413138
stack_depth = -stack_depth;
31423139

3143-
/* Track max measured depth for reporting by proc_exit */
3144-
if (stack_depth > max_measured_stack_depth &&
3145-
stack_base_ptr != NULL)
3146-
max_measured_stack_depth = stack_depth;
3147-
31483140
/*
31493141
* Trouble?
31503142
*
@@ -3168,10 +3160,6 @@ stack_is_too_deep(void)
31683160
#if defined(__ia64__) || defined(__ia64)
31693161
stack_depth = (long) (ia64_get_bsp() - register_stack_base_ptr);
31703162

3171-
if (stack_depth > max_measured_register_stack_depth &&
3172-
register_stack_base_ptr != NULL)
3173-
max_measured_register_stack_depth = stack_depth;
3174-
31753163
if (stack_depth > max_stack_depth_bytes &&
31763164
register_stack_base_ptr != NULL)
31773165
return true;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy