Commit 8f1537d
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 21e1844 commit 8f1537d
1 file changed
+10
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
793 | 794 | | |
794 | 795 | | |
795 | 796 | | |
796 | | - | |
| 797 | + | |
| 798 | + | |
797 | 799 | | |
798 | 800 | | |
799 | 801 | | |
| |||
802 | 804 | | |
803 | 805 | | |
804 | 806 | | |
805 | | - | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
806 | 810 | | |
807 | 811 | | |
808 | 812 | | |
| |||
828 | 832 | | |
829 | 833 | | |
830 | 834 | | |
| 835 | + | |
831 | 836 | | |
832 | 837 | | |
833 | 838 | | |
| |||
887 | 892 | | |
888 | 893 | | |
889 | 894 | | |
890 | | - | |
891 | | - | |
| 895 | + | |
| 896 | + | |
892 | 897 | | |
893 | 898 | | |
894 | 899 | | |
| |||
898 | 903 | | |
899 | 904 | | |
900 | 905 | | |
901 | | - | |
902 | | - | |
903 | 906 | | |
904 | 907 | | |
905 | 908 | | |
906 | 909 | | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
| 910 | + | |
911 | 911 | | |
912 | 912 | | |
913 | 913 | | |
| |||
0 commit comments