Commit c91963d
committed
Set the stack_base_ptr in main(), not in random other places.
Previously we did this in PostmasterMain() and InitPostmasterChild(),
which meant that stack depth checking was disabled in non-postmaster
server processes, for instance in single-user mode. That seems like
a fairly bad idea, since there's no a-priori restriction on the
complexity of queries we will run in single-user mode. Moreover, this
led to not having quite the same stack depth limit in all processes,
which likely has no real-world effect but it offends my inner neatnik.
Setting the depth in main() guarantees that check_stack_depth() is
armed and has a consistent interpretation of stack depth in all forms
of server processes.
While at it, move the code associated with checking the stack depth
out of tcop/postgres.c (which was never a great home for it) into
a new file src/backend/utils/misc/stack_depth.c.
Discussion: https://postgr.es/m/2081982.1734393311@sss.pgh.pa.us1 parent 957ba9f commit c91963d
File tree
9 files changed
+212
-191
lines changed- src
- backend
- main
- postmaster
- tcop
- utils
- init
- misc
- include
- tcop
9 files changed
+212
-191
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
985 | 985 | | |
986 | 986 | | |
987 | 987 | | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | 988 | | |
994 | 989 | | |
995 | 990 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 97 | | |
101 | 98 | | |
102 | 99 | | |
| |||
124 | 121 | | |
125 | 122 | | |
126 | 123 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | 124 | | |
137 | 125 | | |
138 | 126 | | |
| |||
3513 | 3501 | | |
3514 | 3502 | | |
3515 | 3503 | | |
3516 | | - | |
3517 | | - | |
3518 | | - | |
3519 | | - | |
3520 | | - | |
3521 | | - | |
3522 | | - | |
3523 | | - | |
3524 | | - | |
3525 | | - | |
3526 | | - | |
3527 | | - | |
3528 | | - | |
3529 | | - | |
3530 | | - | |
3531 | | - | |
3532 | | - | |
3533 | | - | |
3534 | | - | |
3535 | | - | |
3536 | | - | |
3537 | | - | |
3538 | | - | |
3539 | | - | |
3540 | | - | |
3541 | | - | |
3542 | | - | |
3543 | | - | |
3544 | | - | |
3545 | | - | |
3546 | | - | |
3547 | | - | |
3548 | | - | |
3549 | | - | |
3550 | | - | |
3551 | | - | |
3552 | | - | |
3553 | | - | |
3554 | | - | |
3555 | | - | |
3556 | | - | |
3557 | | - | |
3558 | | - | |
3559 | | - | |
3560 | | - | |
3561 | | - | |
3562 | | - | |
3563 | | - | |
3564 | | - | |
3565 | | - | |
3566 | | - | |
3567 | | - | |
3568 | | - | |
3569 | | - | |
3570 | | - | |
3571 | | - | |
3572 | | - | |
3573 | | - | |
3574 | | - | |
3575 | | - | |
3576 | | - | |
3577 | | - | |
3578 | | - | |
3579 | | - | |
3580 | | - | |
3581 | | - | |
3582 | | - | |
3583 | | - | |
3584 | | - | |
3585 | | - | |
3586 | | - | |
3587 | | - | |
3588 | | - | |
3589 | | - | |
3590 | | - | |
3591 | | - | |
3592 | | - | |
3593 | | - | |
3594 | | - | |
3595 | | - | |
3596 | | - | |
3597 | | - | |
3598 | | - | |
3599 | | - | |
3600 | | - | |
3601 | | - | |
3602 | | - | |
3603 | | - | |
3604 | | - | |
3605 | | - | |
3606 | | - | |
3607 | | - | |
3608 | | - | |
3609 | | - | |
3610 | | - | |
3611 | | - | |
3612 | | - | |
3613 | | - | |
3614 | | - | |
3615 | | - | |
3616 | | - | |
3617 | | - | |
3618 | | - | |
3619 | | - | |
3620 | | - | |
3621 | | - | |
3622 | | - | |
3623 | | - | |
3624 | | - | |
3625 | | - | |
3626 | | - | |
3627 | | - | |
3628 | | - | |
3629 | | - | |
3630 | | - | |
3631 | | - | |
3632 | | - | |
3633 | | - | |
3634 | | - | |
3635 | | - | |
3636 | | - | |
3637 | | - | |
3638 | | - | |
3639 | | - | |
3640 | | - | |
3641 | | - | |
3642 | | - | |
3643 | 3504 | | |
3644 | 3505 | | |
3645 | 3506 | | |
| |||
5099 | 4960 | | |
5100 | 4961 | | |
5101 | 4962 | | |
5102 | | - | |
5103 | | - | |
5104 | | - | |
5105 | | - | |
5106 | | - | |
5107 | | - | |
5108 | | - | |
5109 | | - | |
5110 | | - | |
5111 | | - | |
5112 | | - | |
5113 | | - | |
5114 | | - | |
5115 | | - | |
5116 | | - | |
5117 | | - | |
5118 | | - | |
5119 | | - | |
5120 | | - | |
5121 | | - | |
5122 | | - | |
5123 | | - | |
5124 | | - | |
5125 | | - | |
5126 | | - | |
5127 | | - | |
5128 | | - | |
5129 | | - | |
5130 | | - | |
5131 | | - | |
5132 | | - | |
5133 | | - | |
5134 | | - | |
5135 | | - | |
5136 | 4963 | | |
5137 | 4964 | | |
5138 | 4965 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | 109 | | |
117 | 110 | | |
118 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
0 commit comments