forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitade2d61
committed
Improve detection of child-process SIGPIPE failures.
Commitffa4cbd added logic to detect SIGPIPE failure of a COPY childprocess, but it only worked correctly if the SIGPIPE occurred in theimmediate child process. Depending on the shell in use and thecomplexity of the shell command string, we might instead get backan exit code of 128 + SIGPIPE, representing a shell error exitreporting SIGPIPE in the child process.We could just hack up ClosePipeToProgram() to add the extra case,but it seems like this is a fairly general issue deserving a moregeneral and better-documented solution. I chose to add a coupleof functions in src/common/wait_error.c, which is a natural placeto know about wait-result encodings, that will test for either aspecific child-process signal type or any child-process signal failure.Then, adjust other places that were doing ad-hoc tests of this typeto use the common functions.In RestoreArchivedFile, this fixes a race condition affecting whetherthe process will report an error or just silently proc_exit(1): before,that depended on whether the intermediate shell got SIGTERM'd itselfor reported a child process failing on SIGTERM.Like the previous patch, back-patch to v10; we could go furtherbut there seems no real need to.Per report from Erik Rijkers.Discussion:https://postgr.es/m/f3683f87ab1701bea5d86a7742b22432@xs4all.nl1 parent5e09280 commitade2d61
File tree
5 files changed
+55
-23
lines changed- src
- backend
- access/transam
- commands
- postmaster
- common
- include
5 files changed
+55
-23
lines changedLines changed: 5 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
62 |
| - | |
63 | 62 |
| |
64 | 63 |
| |
65 | 64 |
| |
| |||
289 | 288 |
| |
290 | 289 |
| |
291 | 290 |
| |
292 |
| - | |
293 |
| - | |
294 |
| - | |
295 |
| - | |
| 291 | + | |
296 | 292 |
| |
297 |
| - | |
| 293 | + | |
298 | 294 |
| |
299 | 295 |
| |
300 |
| - | |
301 |
| - | |
302 |
| - | |
| 296 | + | |
303 | 297 |
| |
304 | 298 |
| |
305 | 299 |
| |
| |||
335 | 329 |
| |
336 | 330 |
| |
337 | 331 |
| |
338 |
| - | |
339 | 332 |
| |
340 | 333 |
| |
341 | 334 |
| |
| |||
403 | 396 |
| |
404 | 397 |
| |
405 | 398 |
| |
406 |
| - | |
407 |
| - | |
| 399 | + | |
408 | 400 |
| |
409 |
| - | |
410 |
| - | |
411 |
| - | |
| 401 | + | |
412 | 402 |
| |
413 | 403 |
| |
414 | 404 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 |
| - | |
21 | 20 |
| |
22 | 21 |
| |
23 | 22 |
| |
| |||
1718 | 1717 |
| |
1719 | 1718 |
| |
1720 | 1719 |
| |
1721 |
| - | |
| 1720 | + | |
1722 | 1721 |
| |
1723 | 1722 |
| |
1724 | 1723 |
| |
|
Lines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
627 | 627 |
| |
628 | 628 |
| |
629 | 629 |
| |
630 |
| - | |
631 |
| - | |
632 |
| - | |
633 |
| - | |
634 |
| - | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
635 | 633 |
| |
636 |
| - | |
| 634 | + | |
637 | 635 |
| |
638 | 636 |
| |
639 | 637 |
| |
|
Lines changed: 43 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + |
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
519 | 519 |
| |
520 | 520 |
| |
521 | 521 |
| |
| 522 | + | |
| 523 | + | |
522 | 524 |
| |
523 | 525 |
|
0 commit comments
Comments
(0)