software:postgres_stack_traces
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| software:postgres_stack_traces [2025/10/23 01:00] – created timb | software:postgres_stack_traces [2025/10/23 01:10] (current) – timb | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Postgres Stack Traces ====== | ====== Postgres Stack Traces ====== | ||
| - | See also [[software: | + | See also [[software: |
| Reference ``Matt Smiley' | Reference ``Matt Smiley' | ||
| Line 7: | Line 7: | ||
| Attached are annotated examples of: | Attached are annotated examples of: | ||
| - | * how to capture stack traces using the helper script | + | * how to capture stack traces using the helper script |
| - | * a few tips on finding useful facts in the stack traces | + | * a few tips on finding useful facts in the stack traces |
| - | == How to Capture == | + | ==== How to Capture |
| < | < | ||
| Line 20: | Line 20: | ||
| </ | </ | ||
| - | == How to Analyze == | + | ==== How to Analyze |
| - | * For reference, the output files are usually ~100-1000 KB. | + | * For reference, the output files are usually ~100-1000 KB. |
| < | < | ||
| Line 54: | Line 54: | ||
| #4 0x0000000000612591 in ReadBuffer_common (smgr=< | #4 0x0000000000612591 in ReadBuffer_common (smgr=< | ||
| ... | ... | ||
| + | |||
| </ | </ | ||
| * There are currently 2 helper scripts to simplify and filter the stacks. | * There are currently 2 helper scripts to simplify and filter the stacks. | ||
| - | * ``stack_trace_filter.simplify_frames.pl`` | + | * ``stack_trace_filter.simplify_frames.pl`` |
| * Strips out all arguments from the function. | * Strips out all arguments from the function. | ||
| Line 64: | Line 65: | ||
| * Will consolidate at some point in the future. | * Will consolidate at some point in the future. | ||
| - | * ``stack_trace_filter.regexp_match_on_whole_stack.pl`` | + | * ``stack_trace_filter.regexp_match_on_whole_stack.pl`` |
| * Show whole stack if any frame matches the given perl regexp. | * Show whole stack if any frame matches the given perl regexp. | ||
| Line 76: | Line 77: | ||
| </ | </ | ||
| - | * Examples: | ||
| - | * Review each stack individually, | + | * Examples: |
| + | |||
| + | * Review each stack individually, | ||
| < | < | ||
| Line 155: | Line 157: | ||
| Frame 30 PostmasterMain at postmaster.c: | Frame 30 PostmasterMain at postmaster.c: | ||
| Frame 31 main at main.c:199 | Frame 31 main at main.c:199 | ||
| - | |||
| ... | ... | ||
| + | |||
| </ | </ | ||
| Line 162: | Line 164: | ||
| < | < | ||
| + | |||
| [postgres@db04.prd ~]$ cat / | [postgres@db04.prd ~]$ cat / | ||
| Line 181: | Line 184: | ||
| Frame 13 PostmasterMain at postmaster.c: | Frame 13 PostmasterMain at postmaster.c: | ||
| Frame 14 main at main.c:199 | Frame 14 main at main.c:199 | ||
| + | |||
| </ | </ | ||
| - | * Aggregate frames from all stacks. | + | * Aggregate frames from all stacks. |
| - | * This is helpful for seeing what are the most common frames among all the stacks. | + | * This is helpful for seeing what are the most common frames among all the stacks. |
| - | * Particularly helpful for: | + | * Particularly helpful for: |
| - | * Finding where a single process is spending most of its time, by capturing its stack multiple times during a single query or session, and aggregating the stack traces. | + | * Finding where a single process is spending most of its time, by capturing its stack multiple times during a single query or session, and aggregating the stack traces. |
| - | * Note that a function may appear in different frame numbers, depending on when the process was interrupted. | + | * Note that a function may appear in different frame numbers, depending on when the process was interrupted. |
| - | * The same trick can be used on many processes if they are doing the same thing (e.g. all testtaker sessions behave similarly). | + | * The same trick can be used on many processes if they are doing the same thing (e.g. all testtaker sessions behave similarly). |
| - | * Interpreting system-call traces (strace). | + | |
| < | < | ||
| + | . | ||
| [postgres@db04.prd ~]$ cat / | [postgres@db04.prd ~]$ cat / | ||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ||
| Line 233: | Line 238: | ||
| 1 Frame 4 ResourceOwnerRelease at resowner.c: | 1 Frame 4 ResourceOwnerRelease at resowner.c: | ||
| ... | ... | ||
| + | |||
| </ | </ | ||
| Line 240: | Line 246: | ||
| < | < | ||
| + | |||
| [postgres@db04.prd ~]$ cat / | [postgres@db04.prd ~]$ cat / | ||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ||
| Line 270: | Line 277: | ||
| 13 Frame 12 main at main.c:199 | 13 Frame 12 main at main.c:199 | ||
| 4 Frame 14 ExecProcNode at execProcnode.c: | 4 Frame 14 ExecProcNode at execProcnode.c: | ||
| + | |||
| </ | </ | ||
software/postgres_stack_traces.1761181258.txt.gz · Last modified: by timb
