Question about TCP and IPC handles limit

https://learninghub.kx.com/forums/topic/question-about-tcp-and-ipc-handles-limit

I use CsharpKDB to talk to KDB+ and found an issue to keep too many connection/handle to the port. Seems there is a limit that I cannot keep adding connections to more than 1008. And CsharpKDB c.close() doesn't appears to reduce the existing open connections.

It is easy to demo using IPC:
on server side:
>q.exe -p 5001
q)count .z.H
0

at client side:
>q
q)h:hopen ::5001
q){h:hopen
::12345} each til 1009

'hop. OS reports: An existing connection was forcibly closed by the remote host.

The server side will pop error 'conn as well.

Is this limit of 1008 an OS setting or q.exe limit? Anyway to work around it?

Thanks,

Ning



This limitation was removed in 4.1 release


https://code.kx.com/q/basics/errors/#runtime-errors


conn

Too many connections. Max connections was 1022 prior to 4.1t 2023.09.15, otherwise the limit imposed by the operating system (operating system configurable for system/protocol).


https://code.kx.com/q/releases/ChangesIn4.1/#unlimited-ipcwebsocket-connections


The number of connections is now limited only by the operating system and protocol settings (system configurable).

https://code.kx.com/q/ref/dotz/#zpo-open

https://code.kx.com/q/ref/dotz/#zpc-close

You can use callbacks to see when handles open and close

.z.po:{string[.z.p]," opened ",string x;x}
.z.pc:{string[.z.p]," closed ",string x;x}

Test this against your c.Close() calls to confirm it is closing the handles.

If still seeing a problem raising an issue can be done at: https://github.com/KxSystems/csharpkdb/issues