[erlang-questions] Increase the handle limit

Rickard Green rickard@REDACTED
Mon Oct 24 13:52:32 CEST 2011


Joel Reymont wrote:
> On Oct 21, 2011, at 8:48 PM, Tim Watson wrote:
>
>> Is the gist of this is that select() has a size limit (1024) which has nothing to do with the OS limit on how many file handles you can open at a time? I think Erlang still uses select on a number of platforms and IIRC kqueue on OS-X is somehow broken so Erlang is still using select() on the mac.
>
> It seems that ERTS_POLL_USE_SELECT is defined on the Mac, although +K true is also accepted.
>
> This causes the following block in erts_poll_init() of erts/emulator/sys/common/erl_poll.c to be triggered
>
> #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE)
>     if (max_fds > FD_SETSIZE)
>   max_fds = FD_SETSIZE;
> #endif
>
> This really should NOT be a compile-time setting.
>
> It should check to see if kernell poll, etc. are enabled at runtime and only clip max_fds if they are not.
>

This has been up on the list before...

The "clipping" is there for a reason. Kernel-poll on MacOSX is 
implemented using kqueue(). Neither kqueue() nor poll() can handle all 
types of file-descriptors on MacOSX. The runtime system needs to be able 
to handle any type of file-descriptor that may appear. We are therefore 
forced to fall back on select() when a file-descriptor that cannot be 
handled by kqueue() appears. A file-descriptor that cannot be handled by 
kqueue() may appear at any time, i.e. we need to be able to ensure that 
all file-descriptors that may appear in the runtime-system can be 
handled by select().

Regards,
Rickard
-- 
Rickard Green, Erlang/OTP, Ericsson AB.



More information about the erlang-questions mailing list