
Folks, I need some help from those of you with a FreeBSD box. It looks like 'ulimit -n' on FreeBSD lets you have 10k+ file descriptors open per process. FD_SETSIZE is 1024 in the system headers, though. GHC relies on this value (see ghc/rts/Select.c). Normally, you will get the EMFILE error if you try to open more sockets than what is allowed with 'ulimit -n'. If you allow yourself more than 1024 descriptors per process then you do not get this error but... This seems to lead to a situation where you open more than 1024 sockets and shortly afterwards get 'connection resets' for some or all of your sockets. Maybe just those above 1024, I have not determined this precisely. My question is this: is it possible to get a higher number of open sockets by editing the system header files on FreeBSD and recompiling GHC? Has anyone tried this before? How high can you go? Thanks, Joel -- http://wagerlabs.com/

On Tue, 13 Dec 2005, Joel Reymont wrote:
It looks like 'ulimit -n' on FreeBSD lets you have 10k+ file descriptors open per process. FD_SETSIZE is 1024 in the system headers, though. GHC relies on this value (see ghc/rts/Select.c).
FD_SETSIZE is actually dynamic on FreeBSD (at least from the kernel's
point of view - the macros are less so). You can re-set it to whatever
value you like at compile time (e.g. gcc -DFD_SETSIZE=10240).
Tony.
--
f.a.n.finch

So it's just a matter of recompiling GHC and have it pick up new values? On Dec 13, 2005, at 6:11 PM, Tony Finch wrote:
FD_SETSIZE is actually dynamic on FreeBSD (at least from the kernel's point of view - the macros are less so). You can re-set it to whatever value you like at compile time (e.g. gcc -DFD_SETSIZE=10240).

On Tue, 13 Dec 2005, Joel Reymont wrote:
So it's just a matter of recompiling GHC and have it pick up new values?
Yes.
(It's a pity that the FD_SET macros aren't run-time configurable.)
Tony.
--
f.a.n.finch
participants (2)
-
Joel Reymont
-
Tony Finch