- Notifications
You must be signed in to change notification settings - Fork5
Commit747854f
committed
Fix unwanted flushing of libpq's input buffer when socket EOF is seen.
In commit210eb9b I centralized libpq's logic for closing downthe backend communication socket, and made the new pqDropConnectionroutine always reset the I/O buffers to empty. Many of the call sitespreviously had not had such code, and while that amounted to an oversightin some cases, there was one place where it was intentional and necessary*not* to flush the input buffer: pqReadData should never cause that tohappen, since we probably still want to process whatever data we read.This is the true cause of the problem Robert was attempting to fix inc3e7c24, namely that libpq no longer reported the backend's finalERROR message before reporting "server closed the connection unexpectedly".But that only accidentally fixed it, by invoking parseInput before theinput buffer got flushed; and very likely there are timing scenarioswhere we'd still lose the message before processing it.To fix, pass a flag to pqDropConnection to tell it whether to flush theinput buffer or not. On review I think flushing is actually correct forevery other call site.Back-patch to 9.3 where the problem was introduced. In HEAD, also improvethe comments added byc3e7c24.1 parenta8c209f commit747854f
File tree
4 files changed
+27
-20
lines changed- src/interfaces/libpq
4 files changed
+27
-20
lines changedLines changed: 22 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
391 | 391 |
| |
392 | 392 |
| |
393 | 393 |
| |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
394 | 398 |
| |
395 | 399 |
| |
396 |
| - | |
| 400 | + | |
397 | 401 |
| |
398 | 402 |
| |
399 | 403 |
| |
400 | 404 |
| |
401 | 405 |
| |
402 | 406 |
| |
403 | 407 |
| |
404 |
| - | |
405 |
| - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
406 | 412 |
| |
407 | 413 |
| |
408 | 414 |
| |
| |||
1510 | 1516 |
| |
1511 | 1517 |
| |
1512 | 1518 |
| |
1513 |
| - | |
| 1519 | + | |
1514 | 1520 |
| |
1515 | 1521 |
| |
1516 | 1522 |
| |
| |||
1732 | 1738 |
| |
1733 | 1739 |
| |
1734 | 1740 |
| |
1735 |
| - | |
| 1741 | + | |
1736 | 1742 |
| |
1737 | 1743 |
| |
1738 | 1744 |
| |
| |||
1742 | 1748 |
| |
1743 | 1749 |
| |
1744 | 1750 |
| |
1745 |
| - | |
| 1751 | + | |
1746 | 1752 |
| |
1747 | 1753 |
| |
1748 | 1754 |
| |
| |||
1753 | 1759 |
| |
1754 | 1760 |
| |
1755 | 1761 |
| |
1756 |
| - | |
| 1762 | + | |
1757 | 1763 |
| |
1758 | 1764 |
| |
1759 | 1765 |
| |
| |||
1800 | 1806 |
| |
1801 | 1807 |
| |
1802 | 1808 |
| |
1803 |
| - | |
| 1809 | + | |
1804 | 1810 |
| |
1805 | 1811 |
| |
1806 | 1812 |
| |
| |||
1887 | 1893 |
| |
1888 | 1894 |
| |
1889 | 1895 |
| |
1890 |
| - | |
| 1896 | + | |
1891 | 1897 |
| |
1892 | 1898 |
| |
1893 | 1899 |
| |
| |||
1932 | 1938 |
| |
1933 | 1939 |
| |
1934 | 1940 |
| |
1935 |
| - | |
| 1941 | + | |
1936 | 1942 |
| |
1937 | 1943 |
| |
1938 | 1944 |
| |
| |||
2220 | 2226 |
| |
2221 | 2227 |
| |
2222 | 2228 |
| |
2223 |
| - | |
| 2229 | + | |
2224 | 2230 |
| |
2225 | 2231 |
| |
2226 | 2232 |
| |
| |||
2331 | 2337 |
| |
2332 | 2338 |
| |
2333 | 2339 |
| |
2334 |
| - | |
| 2340 | + | |
2335 | 2341 |
| |
2336 | 2342 |
| |
2337 | 2343 |
| |
| |||
2397 | 2403 |
| |
2398 | 2404 |
| |
2399 | 2405 |
| |
2400 |
| - | |
| 2406 | + | |
2401 | 2407 |
| |
2402 | 2408 |
| |
2403 | 2409 |
| |
| |||
2413 | 2419 |
| |
2414 | 2420 |
| |
2415 | 2421 |
| |
2416 |
| - | |
| 2422 | + | |
2417 | 2423 |
| |
2418 | 2424 |
| |
2419 | 2425 |
| |
| |||
2574 | 2580 |
| |
2575 | 2581 |
| |
2576 | 2582 |
| |
2577 |
| - | |
| 2583 | + | |
2578 | 2584 |
| |
2579 | 2585 |
| |
2580 | 2586 |
| |
| |||
2970 | 2976 |
| |
2971 | 2977 |
| |
2972 | 2978 |
| |
2973 |
| - | |
| 2979 | + | |
2974 | 2980 |
| |
2975 | 2981 |
| |
2976 | 2982 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
815 | 815 |
| |
816 | 816 |
| |
817 | 817 |
| |
818 |
| - | |
| 818 | + | |
| 819 | + | |
819 | 820 |
| |
820 | 821 |
| |
821 | 822 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
446 | 446 |
| |
447 | 447 |
| |
448 | 448 |
| |
449 |
| - | |
450 |
| - | |
| 449 | + | |
| 450 | + | |
451 | 451 |
| |
452 | 452 |
| |
453 | 453 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
514 | 514 |
| |
515 | 515 |
| |
516 | 516 |
| |
517 |
| - | |
| 517 | + | |
518 | 518 |
| |
519 | 519 |
| |
520 | 520 |
| |
|
0 commit comments
Comments
(0)