forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1f39a1c
committed
Restructure libpq's handling of send failures.
Originally, if libpq got a failure (e.g., ECONNRESET) while trying tosend data to the server, it would just report that and wash its handsof the matter. It was soon found that that wasn't a very pleasant wayof coping with server-initiated disconnections, so we introduced a hack(pqHandleSendFailure) in the code that sends queries to make it peekahead for server error reports before reporting the send failure.It now emerges that related cases can occur during connection setup;in particular, as of TLS 1.3 it's unsafe to assume that SSL connectionfailures will be reported by SSL_connect rather than during our firstsend attempt. We could have fixed that in a hacky way by applyingpqHandleSendFailure after a startup packet send failure, but(a) pqHandleSendFailure explicitly disclaims suitability for use in anystate except query startup, and (b) the problem still potentially existsfor other send attempts in libpq.Instead, let's fix this in a more general fashion by eliminatingpqHandleSendFailure altogether, and instead arranging to postponeall reports of send failures in libpq until after we've made anattempt to read and process server messages. The send failure won'tbe reported at all if we find a server message or detect input EOF.(Note: this removes one of the reasons why libpq typically overwrites,rather than appending to, conn->errorMessage: pqHandleSendFailure neededthat behavior so that the send failure report would be replaced if wegot a server message or read failure report. Eventually I'd like to getrid of that overwrite behavior altogether, but today is not that day.For the moment, pqSendSome is assuming that its callees will overwritenot append to conn->errorMessage.)Possibly this change should get back-patched someday; but it needstesting first, so let's not consider that till after v12 beta.Discussion:https://postgr.es/m/CAEepm=2n6Nv+5tFfe8YnkUm1fXgvxR0Mm1FoD+QKG-vLNGLyKg@mail.gmail.com1 parent5e28b77 commit1f39a1c
File tree
6 files changed
+109
-75
lines changed- src/interfaces/libpq
6 files changed
+109
-75
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
537 | 537 |
| |
538 | 538 |
| |
539 | 539 |
| |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
540 | 544 |
| |
541 | 545 |
| |
542 | 546 |
| |
| |||
3702 | 3706 |
| |
3703 | 3707 |
| |
3704 | 3708 |
| |
| 3709 | + | |
| 3710 | + | |
3705 | 3711 |
| |
3706 | 3712 |
| |
3707 | 3713 |
| |
|
Lines changed: 54 additions & 37 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
790 | 790 |
| |
791 | 791 |
| |
792 | 792 |
| |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
793 | 819 |
| |
794 | 820 |
| |
795 | 821 |
| |
| |||
1224 | 1250 |
| |
1225 | 1251 |
| |
1226 | 1252 |
| |
1227 |
| - | |
| 1253 | + | |
1228 | 1254 |
| |
1229 | 1255 |
| |
1230 | 1256 |
| |
| |||
1243 | 1269 |
| |
1244 | 1270 |
| |
1245 | 1271 |
| |
1246 |
| - | |
| 1272 | + | |
1247 | 1273 |
| |
1248 | 1274 |
| |
1249 | 1275 |
| |
| |||
1389 | 1415 |
| |
1390 | 1416 |
| |
1391 | 1417 |
| |
1392 |
| - | |
| 1418 | + | |
1393 | 1419 |
| |
1394 | 1420 |
| |
1395 | 1421 |
| |
| |||
1641 | 1667 |
| |
1642 | 1668 |
| |
1643 | 1669 |
| |
1644 |
| - | |
| 1670 | + | |
1645 | 1671 |
| |
1646 | 1672 |
| |
1647 | 1673 |
| |
1648 |
| - | |
1649 |
| - | |
1650 |
| - | |
1651 |
| - | |
1652 |
| - | |
1653 |
| - | |
1654 |
| - | |
1655 |
| - | |
1656 |
| - | |
1657 |
| - | |
1658 |
| - | |
1659 |
| - | |
1660 |
| - | |
1661 |
| - | |
1662 |
| - | |
1663 |
| - | |
1664 |
| - | |
1665 |
| - | |
1666 |
| - | |
1667 |
| - | |
1668 |
| - | |
1669 |
| - | |
1670 |
| - | |
1671 |
| - | |
1672 |
| - | |
1673 |
| - | |
1674 |
| - | |
1675 |
| - | |
1676 |
| - | |
1677 | 1674 |
| |
1678 | 1675 |
| |
1679 | 1676 |
| |
| |||
1763 | 1760 |
| |
1764 | 1761 |
| |
1765 | 1762 |
| |
1766 |
| - | |
1767 |
| - | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
1768 | 1768 |
| |
1769 | 1769 |
| |
1770 | 1770 |
| |
| |||
1804 | 1804 |
| |
1805 | 1805 |
| |
1806 | 1806 |
| |
1807 |
| - | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
1808 | 1814 |
| |
1809 | 1815 |
| |
1810 | 1816 |
| |
| |||
1820 | 1826 |
| |
1821 | 1827 |
| |
1822 | 1828 |
| |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
1823 | 1840 |
| |
1824 | 1841 |
| |
1825 | 1842 |
| |
| |||
2252 | 2269 |
| |
2253 | 2270 |
| |
2254 | 2271 |
| |
2255 |
| - | |
| 2272 | + | |
2256 | 2273 |
| |
2257 | 2274 |
| |
2258 | 2275 |
| |
|
Lines changed: 45 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
824 | 824 |
| |
825 | 825 |
| |
826 | 826 |
| |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
827 | 834 |
| |
828 | 835 |
| |
829 | 836 |
| |
| |||
832 | 839 |
| |
833 | 840 |
| |
834 | 841 |
| |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
835 | 856 |
| |
836 | 857 |
| |
837 | 858 |
| |
838 | 859 |
| |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
839 | 865 |
| |
840 | 866 |
| |
841 |
| - | |
| 867 | + | |
842 | 868 |
| |
843 | 869 |
| |
844 | 870 |
| |
| |||
876 | 902 |
| |
877 | 903 |
| |
878 | 904 |
| |
| 905 | + | |
879 | 906 |
| |
880 | 907 |
| |
881 |
| - | |
882 |
| - | |
883 |
| - | |
884 |
| - | |
885 |
| - | |
886 |
| - | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
887 | 916 |
| |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
888 | 921 |
| |
889 |
| - | |
| 922 | + | |
890 | 923 |
| |
891 | 924 |
| |
892 | 925 |
| |
| |||
921 | 954 |
| |
922 | 955 |
| |
923 | 956 |
| |
| 957 | + | |
| 958 | + | |
| 959 | + | |
924 | 960 |
| |
925 | 961 |
| |
926 | 962 |
| |
| |||
956 | 992 |
| |
957 | 993 |
| |
958 | 994 |
| |
| 995 | + | |
959 | 996 |
| |
960 | 997 |
| |
961 | 998 |
| |
|
Lines changed: 1 addition & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1450 | 1450 |
| |
1451 | 1451 |
| |
1452 | 1452 |
| |
1453 |
| - | |
| 1453 | + | |
1454 | 1454 |
| |
1455 | 1455 |
| |
1456 | 1456 |
| |
1457 | 1457 |
| |
1458 | 1458 |
| |
1459 | 1459 |
| |
1460 |
| - | |
1461 |
| - | |
1462 | 1460 |
| |
1463 |
| - | |
1464 | 1461 |
| |
1465 | 1462 |
| |
1466 | 1463 |
| |
1467 | 1464 |
| |
1468 |
| - | |
1469 |
| - | |
1470 | 1465 |
| |
1471 |
| - | |
1472 | 1466 |
| |
1473 | 1467 |
| |
1474 | 1468 |
| |
1475 | 1469 |
| |
1476 |
| - | |
1477 |
| - | |
1478 | 1470 |
| |
1479 |
| - | |
1480 | 1471 |
| |
1481 | 1472 |
| |
1482 | 1473 |
| |
1483 | 1474 |
| |
1484 | 1475 |
| |
1485 |
| - | |
1486 |
| - | |
1487 | 1476 |
| |
1488 |
| - | |
1489 | 1477 |
| |
1490 | 1478 |
| |
1491 | 1479 |
| |
|
Lines changed: 1 addition & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1926 | 1926 |
| |
1927 | 1927 |
| |
1928 | 1928 |
| |
1929 |
| - | |
| 1929 | + | |
1930 | 1930 |
| |
1931 | 1931 |
| |
1932 | 1932 |
| |
1933 | 1933 |
| |
1934 | 1934 |
| |
1935 | 1935 |
| |
1936 |
| - | |
1937 |
| - | |
1938 | 1936 |
| |
1939 |
| - | |
1940 | 1937 |
| |
1941 | 1938 |
| |
1942 | 1939 |
| |
1943 | 1940 |
| |
1944 | 1941 |
| |
1945 | 1942 |
| |
1946 |
| - | |
1947 |
| - | |
1948 | 1943 |
| |
1949 |
| - | |
1950 | 1944 |
| |
1951 | 1945 |
| |
1952 | 1946 |
| |
1953 | 1947 |
| |
1954 |
| - | |
1955 |
| - | |
1956 | 1948 |
| |
1957 |
| - | |
1958 | 1949 |
| |
1959 | 1950 |
| |
1960 | 1951 |
| |
1961 | 1952 |
| |
1962 |
| - | |
1963 |
| - | |
1964 | 1953 |
| |
1965 |
| - | |
1966 | 1954 |
| |
1967 | 1955 |
| |
1968 | 1956 |
| |
1969 |
| - | |
1970 |
| - | |
1971 | 1957 |
| |
1972 |
| - | |
1973 | 1958 |
| |
1974 | 1959 |
| |
1975 | 1960 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
410 | 410 |
| |
411 | 411 |
| |
412 | 412 |
| |
| 413 | + | |
| 414 | + | |
413 | 415 |
| |
414 | 416 |
| |
415 | 417 |
| |
| |||
585 | 587 |
| |
586 | 588 |
| |
587 | 589 |
| |
588 |
| - | |
589 | 590 |
| |
590 | 591 |
| |
591 | 592 |
| |
|
0 commit comments
Comments
(0)