forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2ddb914
committed
Server-side fix for delayed NOTIFY and SIGTERM processing.
Commit4f85fde introduced some code that was meant to ensure that we'dprocess cancel, die, sinval catchup, and notify interrupts while waitingfor client input. But there was a flaw: it supposed that the processlatch would be set upon arrival at secure_read() if any such interruptwas pending. In reality, we might well have cleared the process latchat some earlier point while those flags remained set -- particularlynotifyInterruptPending, which can't be handled as long as we're withina transaction.To fix the NOTIFY case, also attempt to process signals (exceptProcDiePending) before trying to read.Also, if we see that ProcDiePending is set before we read, forcibly set theprocess latch to ensure that we will handle that signal promptly if no datais available. I also made it set the process latch on the way out, in casethere is similar logic elsewhere. (It remains true that we won't serviceProcDiePending here unless we need to wait for input.)The code for handling ProcDiePending during a write needs those changes,too.Also be a little more careful about when to reset whereToSendOutput,and improve related comments.Back-patch to 9.5 where this code was added. I'm not entirely convincedthat older branches don't have similar issues, but the complaint at handis just about the >= 9.5 code.Jeff Janes and Tom LaneDiscussion:https://postgr.es/m/CAOYf6ec-TmRYjKBXLLaGaB-jrd=mjG1Hzn1a1wufUAR39PQYhw@mail.gmail.com1 parent12bfb77 commit2ddb914
2 files changed
+62
-35
lines changedLines changed: 12 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
| 148 | + | |
| 149 | + | |
| 150 | + | |
148 | 151 |
| |
149 | 152 |
| |
150 | 153 |
| |
| |||
209 | 212 |
| |
210 | 213 |
| |
211 | 214 |
| |
212 |
| - | |
213 |
| - | |
214 |
| - | |
| 215 | + | |
| 216 | + | |
215 | 217 |
| |
216 | 218 |
| |
217 | 219 |
| |
| |||
248 | 250 |
| |
249 | 251 |
| |
250 | 252 |
| |
| 253 | + | |
| 254 | + | |
| 255 | + | |
251 | 256 |
| |
252 | 257 |
| |
253 | 258 |
| |
| |||
287 | 292 |
| |
288 | 293 |
| |
289 | 294 |
| |
290 |
| - | |
291 |
| - | |
| 295 | + | |
| 296 | + | |
292 | 297 |
| |
293 | 298 |
| |
294 | 299 |
| |
295 | 300 |
| |
296 | 301 |
| |
297 | 302 |
| |
298 |
| - | |
299 |
| - | |
300 |
| - | |
| 303 | + | |
| 304 | + | |
301 | 305 |
| |
302 | 306 |
| |
303 | 307 |
| |
|
Lines changed: 50 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
315 | 315 |
| |
316 | 316 |
| |
317 | 317 |
| |
318 |
| - | |
| 318 | + | |
319 | 319 |
| |
320 | 320 |
| |
321 | 321 |
| |
| |||
520 | 520 |
| |
521 | 521 |
| |
522 | 522 |
| |
523 |
| - | |
524 |
| - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
525 | 526 |
| |
526 | 527 |
| |
527 | 528 |
| |
| |||
532 | 533 |
| |
533 | 534 |
| |
534 | 535 |
| |
535 |
| - | |
| 536 | + | |
536 | 537 |
| |
537 | 538 |
| |
538 |
| - | |
| 539 | + | |
539 | 540 |
| |
540 | 541 |
| |
541 | 542 |
| |
542 |
| - | |
| 543 | + | |
543 | 544 |
| |
544 | 545 |
| |
545 | 546 |
| |
546 |
| - | |
| 547 | + | |
547 | 548 |
| |
548 | 549 |
| |
549 |
| - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
550 | 556 |
| |
551 |
| - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
552 | 561 |
| |
553 | 562 |
| |
554 | 563 |
| |
| |||
557 | 566 |
| |
558 | 567 |
| |
559 | 568 |
| |
560 |
| - | |
561 |
| - | |
562 |
| - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
563 | 572 |
| |
564 | 573 |
| |
565 | 574 |
| |
| |||
568 | 577 |
| |
569 | 578 |
| |
570 | 579 |
| |
571 |
| - | |
572 |
| - | |
573 |
| - | |
574 |
| - | |
575 |
| - | |
576 |
| - | |
577 |
| - | |
578 |
| - | |
| 580 | + | |
579 | 581 |
| |
580 | 582 |
| |
581 |
| - | |
582 |
| - | |
583 |
| - | |
584 |
| - | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
585 | 590 |
| |
586 |
| - | |
587 |
| - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
588 | 607 |
| |
589 |
| - | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
590 | 613 |
| |
591 | 614 |
| |
592 | 615 |
| |
|
0 commit comments
Comments
(0)