- Notifications
You must be signed in to change notification settings - Fork28
Commit8939020
committed
Run the postmaster's signal handlers without SA_RESTART.
The postmaster keeps signals blocked everywhere except while waitingfor something to happen in ServerLoop(). The code expects that theselect(2) will be cancelled with EINTR if an interrupt occurs; withoutthat, followup actions that should be performed by ServerLoop() itselfwill be delayed. However, some platforms interpret the SA_RESTARTsignal flag as meaning that they should restart rather than cancelthe select(2). Worse yet, some of them restart it with the originaltimeout delay, meaning that a steady stream of signal interrupts canprevent ServerLoop() from iterating at all if there are no incomingconnection requests.Observable symptoms of this, on an affected platform such as HPUX 10,include extremely slow parallel query startup (possibly as much as30 seconds) and failure to update timestamps on the postmaster's socketsand lockfiles when no new connections arrive for a long time.We can fix this by running the postmaster's signal handlers withoutSA_RESTART. That would be quite a scary change if the range of codewhere signals are accepted weren't so tiny, but as it is, it seemssafe enough. (Note that postmaster children do, and must, reset allthe handlers before unblocking signals; so this change should notaffect any child process.)There is talk of rewriting the postmaster to use a WaitEventSet andnot do signal response work in signal handlers, at which point it mightbe appropriate to revert this patch. But that's not happening beforev11 at the earliest.Back-patch to 9.6. The problem exists much further back, but theworst symptom arises only in connection with parallel query, so itdoes not seem worth taking any portability risks in older branches.Discussion:https://postgr.es/m/9205.1492833041@sss.pgh.pa.us1 parentcbc2270 commit8939020
File tree
3 files changed
+56
-9
lines changed- src
- backend/postmaster
- include
- port
3 files changed
+56
-9
lines changedLines changed: 21 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
611 | 611 |
| |
612 | 612 |
| |
613 | 613 |
| |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
614 | 623 |
| |
615 | 624 |
| |
616 | 625 |
| |
| |||
621 | 630 |
| |
622 | 631 |
| |
623 | 632 |
| |
624 |
| - | |
625 |
| - | |
626 |
| - | |
627 |
| - | |
628 |
| - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
629 | 640 |
| |
630 | 641 |
| |
631 |
| - | |
632 |
| - | |
633 |
| - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
634 | 647 |
| |
635 | 648 |
| |
636 | 649 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
469 | 469 |
| |
470 | 470 |
| |
471 | 471 |
| |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
472 | 477 |
| |
473 | 478 |
| |
474 | 479 |
| |
|
Lines changed: 30 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
35 |
| - | |
| 35 | + | |
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
61 | 90 |
|
0 commit comments
Comments
(0)