postgresql/src
Heikki Linnakangas 4fce5f970d Disconnect if socket cannot be put into non-blocking mode
Commit 387da18874 moved the code to put socket into non-blocking mode
from socket_set_nonblocking() into the one-time initialization
function, pq_init(). In socket_set_nonblocking(), there indeed was a
risk of recursion on failure like the comment said, but in pq_init(),
ERROR or FATAL is fine. There's even another elog(FATAL) just after
this, if setting FD_CLOEXEC fails.

Note that COMMERROR merely logged the error, it did not close the
connection, so if putting the socket to non-blocking mode failed we
would use the connection anyway. You might not immediately notice,
because most socket operations in a regular backend wait for the
socket to become readable/writable anyway. But e.g. replication will
be quite broken.

Backpatch to all supported versions.

Discussion: https://www.postgresql.org/message-id/d40a5cd0-2722-40c5-8755-12e9e811fa3c@iki.fi
2024-03-12 10:18:50 +02:00
..
backend Disconnect if socket cannot be put into non-blocking mode 2024-03-12 10:18:50 +02:00
bin Skip .DS_Store files in server side utils 2024-02-13 13:47:12 +01:00
common Move is_valid_ascii() to ascii.h. 2024-01-29 12:09:08 -06:00
fe_utils Don't spuriously report FD_SETSIZE exhaustion on Windows. 2023-10-14 15:54:49 -07:00
include Revert "Fix parallel-safety check of expressions and predicate for index builds" 2024-03-07 08:31:04 +09:00
interfaces Cope with a deficiency in OpenSSL 3.x's error reporting. 2024-03-07 19:37:51 -05:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl Translation updates 2024-02-05 14:47:58 +01:00
port Clean up Windows-specific mutex code in libpq and ecpglib. 2024-02-09 11:11:39 -05:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:28:55 -04:00
test Fix incorrect accessing of pfree'd memory in Memoize 2024-03-11 18:21:23 +13:00
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools Fix various issues with ALTER TEXT SEARCH CONFIGURATION 2024-01-31 13:16:46 +09:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Suppress macOS warnings about duplicate libraries in link commands. 2023-09-29 14:07:30 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk Improve frontend error logging style. 2022-04-08 14:55:14 -04:00