- Notifications
You must be signed in to change notification settings - Fork28
Commit4fe384b
committed
Process 'die' interrupts while reading/writing from the client socket.
Up to now it was impossible to terminate a backend that was trying tosend/recv data to/from the client when the socket's buffer was alreadyfull/empty. While the send/recv calls itself might have gotteninterrupted by signals on some platforms, we just immediately retried.That could lead to situations where a backend couldn't be terminated ,after a client died without the connection being closed, because itwas blocked in send/recv.The problem was far more likely to be hit when sending data than whenreading. That's because while reading a command from the client, andduring authentication, we processed interrupts immediately . Thatprimarily left COPY FROM STDIN as being problematic for recv.Change things so that that we process 'die' events immediately whenthe appropriate signal arrives. We can't sensibly react to querycancels at that point, because we might loose sync with the client aswe could be in the middle of writing a message.We don't interrupt writes if the write buffer isn't full, as indicatedby write() returning EWOULDBLOCK, as that would lead to fewer errormessages reaching clients.Per discussion with Kyotaro HORIGUCHI and Heikki LinnakangasDiscussion: 20140927191243.GD5423@alap3.anarazel.de1 parent4f85fde commit4fe384b
File tree
4 files changed
+105
-30
lines changed- src
- backend
- libpq
- tcop
- include/tcop
4 files changed
+105
-30
lines changedLines changed: 18 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
553 | 553 |
| |
554 | 554 |
| |
555 | 555 |
| |
556 |
| - | |
| 556 | + | |
557 | 557 |
| |
558 | 558 |
| |
559 | 559 |
| |
| |||
595 | 595 |
| |
596 | 596 |
| |
597 | 597 |
| |
| 598 | + | |
598 | 599 |
| |
599 | 600 |
| |
600 | 601 |
| |
| |||
659 | 660 |
| |
660 | 661 |
| |
661 | 662 |
| |
| 663 | + | |
| 664 | + | |
662 | 665 |
| |
663 |
| - | |
| 666 | + | |
664 | 667 |
| |
665 |
| - | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
666 | 671 |
| |
667 |
| - | |
668 | 672 |
| |
669 |
| - | |
670 |
| - | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
671 | 677 |
| |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
672 | 684 |
| |
673 | 685 |
| |
674 | 686 |
| |
|
Lines changed: 37 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
143 |
| - | |
144 |
| - | |
145 |
| - | |
146 | 143 |
| |
147 | 144 |
| |
148 | 145 |
| |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
149 | 154 |
| |
150 | 155 |
| |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
151 | 164 |
| |
152 | 165 |
| |
153 | 166 |
| |
| |||
224 | 237 |
| |
225 | 238 |
| |
226 | 239 |
| |
227 |
| - | |
228 |
| - | |
229 |
| - | |
230 |
| - | |
231 |
| - | |
232 |
| - | |
233 |
| - | |
234 |
| - | |
235 |
| - | |
236 |
| - | |
| 240 | + | |
237 | 241 |
| |
238 | 242 |
| |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
239 | 251 |
| |
240 | 252 |
| |
241 | 253 |
| |
| |||
262 | 274 |
| |
263 | 275 |
| |
264 | 276 |
| |
265 |
| - | |
266 |
| - | |
267 |
| - | |
268 |
| - | |
269 |
| - | |
270 |
| - | |
271 | 277 |
| |
272 |
| - | |
| 278 | + | |
273 | 279 |
| |
274 | 280 |
| |
275 |
| - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
276 | 292 |
| |
277 | 293 |
| |
278 | 294 |
| |
|
Lines changed: 48 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
318 | 318 |
| |
319 | 319 |
| |
320 | 320 |
| |
321 |
| - | |
| 321 | + | |
322 | 322 |
| |
323 | 323 |
| |
324 | 324 |
| |
| |||
529 | 529 |
| |
530 | 530 |
| |
531 | 531 |
| |
532 |
| - | |
| 532 | + | |
533 | 533 |
| |
534 | 534 |
| |
535 | 535 |
| |
| |||
546 | 546 |
| |
547 | 547 |
| |
548 | 548 |
| |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
549 | 556 |
| |
550 | 557 |
| |
551 | 558 |
| |
552 | 559 |
| |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
553 | 599 |
| |
554 | 600 |
| |
555 | 601 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
67 | 67 |
| |
68 | 68 |
| |
69 | 69 |
| |
70 |
| - | |
| 70 | + | |
| 71 | + | |
71 | 72 |
| |
72 | 73 |
| |
73 | 74 |
| |
|
0 commit comments
Comments
(0)