Commit 57c5ad1
committed
Fix possibility of self-deadlock in ResolveRecoveryConflictWithBufferPin().
The tests added in 9f8a050 failed nearly reliably on FreeBSD in CI, and
occasionally on the buildfarm. That turns out to be caused not by a bug in the
test, but by a longstanding bug in recovery conflict handling.
The standby timeout handler, used by ResolveRecoveryConflictWithBufferPin(),
executed SendRecoveryConflictWithBufferPin() inside a signal handler. A bad
idea, because the deadlock timeout handler (or a spurious latch set) could
have interrupted ProcWaitForSignal(). If unlucky that could cause a
self-deadlock on ProcArrayLock, if the deadlock check is in
SendRecoveryConflictWithBufferPin()->CancelDBBackends().
To fix, set a flag in StandbyTimeoutHandler(), and check the flag in
ResolveRecoveryConflictWithBufferPin().
Subsequently the recovery conflict tests will be backpatched.
Discussion: https://postgr.es/m/20220413002626.udl7lll7f3o7nre7@alap3.anarazel.de
Backpatch: 10-1 parent 90abe1e commit 57c5ad1
1 file changed
+12
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
603 | 604 | | |
604 | 605 | | |
605 | 606 | | |
606 | | - | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
607 | 611 | | |
608 | 612 | | |
609 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
610 | 616 | | |
611 | 617 | | |
612 | 618 | | |
| |||
632 | 638 | | |
633 | 639 | | |
634 | 640 | | |
| 641 | + | |
635 | 642 | | |
636 | 643 | | |
637 | 644 | | |
| |||
691 | 698 | | |
692 | 699 | | |
693 | 700 | | |
694 | | - | |
695 | | - | |
| 701 | + | |
| 702 | + | |
696 | 703 | | |
697 | 704 | | |
698 | 705 | | |
| |||
702 | 709 | | |
703 | 710 | | |
704 | 711 | | |
705 | | - | |
706 | | - | |
707 | 712 | | |
708 | 713 | | |
709 | 714 | | |
710 | 715 | | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
| 716 | + | |
715 | 717 | | |
716 | 718 | | |
717 | 719 | | |
| |||
0 commit comments