mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Don't spuriously report FD_SETSIZE exhaustion on Windows.
Starting on 2023-08-03, this intermittently terminated a "pgbench -C" test in CI. It could affect a high-client-count "pgbench" without "-C". While parallel reindexdb and vacuumdb reach the same problematic check, sufficient client count and/or connection turnover is less plausible for them. Given the lack of examples from the buildfarm or from manual builds, reproducing this must entail rare operating system configurations. Also correct the associated error message, which was wrong for non-Windows. Back-patch to v12, where the pgbench check first appeared. While v11 vacuumdb has the problematic check, reaching it with typical vacuumdb usage is implausible. Reviewed by Thomas Munro. Discussion: https://postgr.es/m/CA+hUKG+JwvTNdcyJTriy9BbtzF1veSRQ=9M_ZKFn9_LqE7Kp7Q@mail.gmail.com
This commit is contained in:
@@ -7837,14 +7837,23 @@ clear_socket_set(socket_set *sa)
|
||||
static void
|
||||
add_socket_to_set(socket_set *sa, int fd, int idx)
|
||||
{
|
||||
/* See connect_slot() for background on this code. */
|
||||
#ifdef WIN32
|
||||
if (sa->fds.fd_count + 1 >= FD_SETSIZE)
|
||||
{
|
||||
pg_log_error("too many concurrent database clients for this platform: %d",
|
||||
sa->fds.fd_count + 1);
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
if (fd < 0 || fd >= FD_SETSIZE)
|
||||
{
|
||||
/*
|
||||
* Doing a hard exit here is a bit grotty, but it doesn't seem worth
|
||||
* complicating the API to make it less grotty.
|
||||
*/
|
||||
pg_fatal("too many client connections for select()");
|
||||
pg_log_error("socket file descriptor out of range for select(): %d",
|
||||
fd);
|
||||
pg_log_error_hint("Try fewer concurrent database clients.");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
FD_SET(fd, &sa->fds);
|
||||
if (fd > sa->maxfd)
|
||||
sa->maxfd = fd;
|
||||
|
||||
Reference in New Issue
Block a user