[erlang-questions] Fwd: Re: Increase the handle limit

Rickard Green rickard.s.green@REDACTED
Tue Oct 25 16:07:27 CEST 2011

Forgot reply all...

-------- Original Message --------
Subject: Re: [erlang-questions] Increase the handle limit
Date: Tue, 25 Oct 2011 16:05:58 +0200
From: Rickard Green <>
To: Joel Reymont <joelr1@REDACTED>

On 10/25/2011 02:54 PM, Joel Reymont wrote:
> On Oct 25, 2011, at 1:27 PM, Rickard Green wrote:
>> I tried to access the darwin-dev web archive, but I'm not able to access it, so I don't know what have been said to you there.
> Mirrored here:
> http://groups.google.com/group/darwin-dev/browse_thread/thread/a7e2e4bec12d4472

The only statement that I can find that suggests that we could use
kqueue() without fallback is the following:
  > As far as I am aware, select() and poll() are strict subsets
  > feature-wise of kqueue, so I would be very curious to find a
  > counter example.

But I cannot figure out who made the statement?

The quick test I made (see below) suggests that this isn't true.

Note that kqueue() and epoll() need fallbacks on other systems too. This
is not MacOSX specific. However, on most other systems we can use poll()
as fallback.

>> I did a quick test on our MacOSX Lion machine which suggests that kqueue() cannot be used for devices. I may have made something wrong, though, but I don't have more time to put on this.
> Can you please send me the code?

I modified erts/<TARGET>/config.h after running configure in the
following way:
    undefined USE_SELECT and defined ERTS_USE_POLL to 1

Then built the runtime system.

This enables poll() as fallback instead of select().

I then tried the following:

2> open_port("/dev/zero", []), erlang:yield(), flush().

=ERROR REPORT==== 25-Oct-2011::13:14:06 ===
Bad input fd in erts_poll()! fd=12, port=#Port<0.536>, driver=vanilla,

When select() is a fallback the shell will get messages containing zeros.

This suggests that kqueue fails to handle the file-descriptor for
/dev/zero but select() is able to handle it (while poll() isn't).
However, I have not verified each step (and wont have time to do that)
and this is why I don't claim to be completely sure of it. Feel free to
dig into it.

>> If you think kqueue() on MacOSX can be used without fallback, you have to dig that information up and present it for us. Also provide us with test cases that show that it for example can handle devices, etc...
> Digging into your quick test would be a good start.
> --------------------------------------------------------------------------
> - for hire: mac osx device driver ninja, kernel extensions and usb drivers
> ---------------------+------------+---------------------------------------
> http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
> ---------------------+------------+---------------------------------------

Rickard Green, Erlang/OTP, Ericsson AB.

More information about the erlang-questions mailing list