Subject: Re: reached select() limit

Re: reached select() limit

From: Daniel Hardman <daniel.hardman_at_gmail.com>
Date: Tue, 24 Jan 2017 21:35:46 -0700

Thank you for reminding me about the select() limit's relationship to
FD_SET. I had forgotten that.

My quick answer about setrlimit() was based on a binary I worked in that
used c-ares plus numerous other socket-oriented libraries. I ran into the
FD_SET problem in my other socket-dependent layers, and converted them to
use epoll. Once I did so, I stopped seeing the limitation (after I also
called setrlimit()). This leads me to believe that David's theorized
workaround might be reasonably reliable, because otherwise the epoll
upgrade I did wouldn't have eliminated the problem for the c-ares layers. I
think my code had to do a DNS lookup before any other network I/O happened,
so c-ares got very low fd numbers...

--Daniel

On Tue, Jan 24, 2017 at 8:05 PM, Zan Lynx <zlynx_at_acm.org> wrote:

> On January 24, 2017 7:16:35 PM MST, Daniel Hardman <
> daniel.hardman_at_gmail.com> wrote:
> >Your program should call setrlimit on startup to change the number of
> >file
> >descriptors. See http://unix.stackexchange.com/a/29579.
> >
> >
>
>
> That will not help because select has a hard coded limit of the number of
> bits in its read, write and error sets.
>
> What could help us to open c-ares socket very early in the program to get
> a low FD number. Or switch to poll. I posted a half done, good enough for
> me poll fix to this list some years ago. Or use one of the other APIs to
> get the socket descriptors and poll.
>
Received on 2017-01-25