buildFdSets: file descriptor out of range

Johan Tibell johan.tibell at
Wed Jul 15 11:44:48 EDT 2009

2009/7/15 Simon Marlow <marlowsd at>

> On 15/07/2009 05:16, Brandon S. Allbery KF8NH wrote:
> Reduce this to 1024, otherwise the runtime will eventually find itself
>> dealing with file descriptors beyond the select() limit mentioned above.
>> Someone with more knowledge of the Haskell runtime will have to advise
>> as to possible ways around it if you really need more than 1024 file
>> descriptors.
> There's no easy workaround.  We could have the IO library switch to using
> blocking read() calls for the out-of-range FDs to avoid the error from the
> IO manager, but that is likely to lead to a different problem: too many OS
> threads.
> The right fix is to move to using epoll() instead.  I understand it is
> being worked on, but I don't know the current status (Johan?).

I have a standalone (i.e. not integrated into the RTS yet) proof of concept
working using kqueue. However, to be portable we still need to fall back to
select on systems that don't support anything better. This implies that if
you want to write portable code you still suffer from this limit.

I've been unable to hack lately due to an injury but I'll be able to get
back to it next week.

- Johan
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Glasgow-haskell-users mailing list