> Select cannot safely be used with programs that have more than 1024 file descriptors on a Linux system. This is because the underlying fd_set that the select system call uses is a fixed sized buffer i.e. its size is allocated at > compile time, not run time.
> 
> From man 2 select:
> 
    int select(int nfds, fd_set *readfds, fd_set *writefds,
>                    fd_set *exceptfds, > struct timeval *timeout);
> 
An `fd_set` is a fixed size buffer. Executing `FD_CLR()` or `FD_SET()` with a value of fd that is negative or is equal to or larger than `FD_SETSIZE` will result in undefined behavior. Moreover, POSIX requires fd to be a valid file > descriptor.
> 
This means that if you have more than 1024 file descriptors in your program, > and you use the select system call, you will end up with memory corruption.
> 
If you want to use more than 1024 file descriptors in your program, you must use `poll` or `epoll`, and ensure that you never use select, or you will get random memory corruption. Changing the size of the file descriptor table > through `ulimit` is very dangerous if you are using select. Don't do it.
> 
Ruby's select does seem to be actually implemented with the select system call, so while it may look like increasing ulimit works, under the hood > corruption is happening: https://github.com/ruby/ruby/blob/trunk/thread.c
> 
Furthermore, some unrelated API's in ruby seem to use select (see thread_pthread.c) so it's probably also unsafe to use those, or any code that uses those API's within a ruby program running with a file descriptor table > larger than 1024.