[Haskell-cafe] FreeBSD: Max # of sockets opened

Joel Reymont joelr1 at gmail.com
Tue Dec 13 12:56:04 EST 2005


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  

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


More information about the Haskell-Cafe mailing list