On 2020-11-06 23:54, Ranier Vilela wrote:
Hi Marina,

Hello!

Nice catch.

Thank you!

rc/bin/pgbench/pgbench.c, the function add_socket_to_set:
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_log_fatal("too many client connections for select()");
exit(1);
}

It seems to me that the limit is hardcode in,
src/backend/port/win32/socket.c

FD_SETSIZE * 2

that would be 2048?

1) If you mean the function pgwin32_select in the file src/backend/port/win32/socket.c, IIUC it is only used in the backend, see src/include/port/win32_port.h:

#ifndef FRONTEND
<...>
#define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout)
<...>
#endif                                                  /* FRONTEND */

2) It looks like FD_SETSIZE does not set a limit on the socket value on Windows, see https://docs.microsoft.com/en-us/windows/win32/winsock/maximum-number-of-sockets-supported-2 :

The maximum number of sockets that a Windows Sockets application can use is not affected by the manifest constant FD_SETSIZE. This value defined in the Winsock2.h header file is used in constructing the FD_SET structures used with select function.

--
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


Reply via email to