trysetrlimit always raises on Mac OS X

Eric Wong normalperson at
Fri Sep 16 06:42:09 EDT 2011

Claudio Poli <claudio at> wrote:
> Hello,
> I decided to investigate on why rainbows! prints out Invalid argument
> - setrlimit on Lion.

Rainbows! isn't supported on non-Free operating systems even though it
probably works.

> It turns out the method trysetrlimit in http_server.rb is trying to
> set RLIMIT_NOFILE to the maximum allowed number that it finds through
> cur, max = Process.getrlimit(var)
> This +max+ variable holds 9223372036854775807, while 256 is the +cur+ value.

OSX is broken here for returning RLIMIT_INFINITY (9223372036854775807).
Working around broken things non-Free systems just encourages them
to stay broken.

If it were a Free system, I /might/ work around it while simultaneously
getting it fixed upstream[1].  But this is a non-fatal error and just
writes to the log, it won't stop Rainbows! from working.  You can still
set the limit higher before you start the process.

If you're stuck on OSX, pressure OSX devs into fixing it.  Remember, you
(or your organization) _paid_ for OSX.

> Currently setting this kind of limits on OSX is tricky at best and for
> some is not a recommended practice, I will not be surprised if this
> turns out to be a Ruby bug. I'm using 1.9.3-preview1 for this tests.

Reading over the code in the Ruby trunk and ruby_1_9_3 branch, it looks
fine and runs fine on GNU/Linux.

[1] - we've done this in the past with MRI 1.8/1.9 bugs and have gotten
      everything fixed upstream

More information about the rainbows-talk mailing list