R10B3 crashes after >1014 tcp connections + Yaws

Bjorn Gustavsson <>
Mon Jun 13 13:59:01 CEST 2005


Claes Wikstrom <> writes:

> joel reymont wrote:
> > I took a quick look at the source code and there are quite a few
> > places where FD_SETSIZE is hardcoded. So the number of open files
> > fixed at 1024 on my Mac OSX 10.3.9. I could certainly edit the system
> > header files and increase the limit to  a more suitable number but...
> 
> I seem to remember a couple of years ago when we had to
> support erlang on the BSDi OS, there was the same braindead
> FD_SETSIZE limitation.
> 
> There was some trickery around it but I don't remember
> exactly, but I think it involved modified system headers.
> 

FD_SETSIZE can be defined before including <sys/types.h>.
That will change the size of struct fd_set.

It is mentioned in the man page for select() on Mac OS X.

We still have code in OTP to raise the value of FD_SETSIZE from
256 to 1024 on a platform called BSDi. (See erts/configure.in.)

Using that mechanism, it should be possibly to further raise the
limit by three easy changes to config.h (AFTER running configure):

1) Define REDEFINE_FD_SETSIZE.

2) #define USE_SELECT  (Will not be necessary in R10B-6, because it is already
done.

3) Change the define for FD_SETSIZE to an appropriate value.

I don't know how many file descriptors the Mac OS X kernel actually supports,
but the man page suggests that it is more than 1024.

> An alternative for your customers that require +1024 fds
> is to use OS X 10.4 which use poll() (I think)
> 

No, poll() in Mac OS X 10.4 doesn't support devices. configure in R10B-6
will detect that and force the use of select().

/Bjorn
-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list