Re: pgbench stopped supporting large number of client connections on Windows - Mailing list pgsql-hackers

From Marina Polyakova
Subject Re: pgbench stopped supporting large number of client connections on Windows
Date
Msg-id d6572af5f68ac1d42fd133d49bf674e6@postgrespro.ru
Whole thread Raw
In response to re: pgbench stopped supporting large number of client connections on Windows  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: pgbench stopped supporting large number of client connections on Windows  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: RE: pgbench: option delaying queries till connections establishment?
Next
From: Ranier Vilela
Date:
Subject: Re: pgbench stopped supporting large number of client connections on Windows