Subject: Re: reached select() limit

Re: reached select() limit

From: Brad House via c-ares <c-ares_at_cool.haxx.se>
Date: Tue, 24 Jan 2017 21:54:15 -0500

David is correct, on many systems, like Linux, select() cannot handle
file descriptor *numbers*, higher than 1023 (most people assume it is
just the count of fds set via FD_SET cannot exceed 1024, which is also true).

Since he stated he is working with fds higher than that, it is presumed
his rlimits are already set correctly.

-Brad

On 1/24/17 9:16 PM, Daniel Hardman wrote:
> Your program should call setrlimit on startup to change the number of file descriptors.
> See http://unix.stackexchange.com/a/29579.
>
> On Tue, Jan 24, 2017 at 5:14 PM, Brad House via c-ares <c-ares_at_cool.haxx.se <mailto:c-ares_at_cool.haxx.se>> wrote:
>
> I'm pretty sure c-ares just uses a single socket per nameserver, so to
> have more than 16 socks, you'd have to have more than 8 DNS servers (I'm
> assuming here that each server tries both UDP, then due to response
> overflow has to retry via TCP).
>
> I use c-ares with an event based system where we use epoll()/kqueue()
> instead of select, we load test regularly with high connection counts,
> can't say we've seen an issue.
>
> -Brad
>
>
> On 1/24/17 6:18 PM, David Guillen Fandos wrote:
>
> Hello,
>
> I wrote an app that was crashing in c-ares due to fds being bigger than 1024. While c-ares might be using around
> 30 fds
> it is unable to use fds above 1024.
>
> I looked into using getsock but it is capped at 16 sockets (although could be worked around by building c-ares
> myself
> and tweaking the constant).
>
> Is there any other way or suggestion? I thought of initializing c-ares at the startup phase so I always get
> smallish fds
> but it is a bit dodgy :D My program uses many many sockets
>
> Thanks!
>
> David
>
>
Received on 2017-01-25