Re: pgbench stopped supporting large number of client connections on Windows

From: Marina Polyakova <m(dot)polyakova(at)postgrespro(dot)ru>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench stopped supporting large number of client connections on Windows
Date: 2020-11-07 17:55:19
Message-ID: d6572af5f68ac1d42fd133d49bf674e6@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2020-11-07 18:17:13 Re: pgbench stopped supporting large number of client connections on Windows
Previous Message Fabien COELHO 2020-11-07 17:33:27 RE: pgbench: option delaying queries till connections establishment?