Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
* trysetrlimit always raises on Mac OS X
@ 2011-09-16  1:43 Claudio Poli
       [not found] ` <2A8DD860-975F-4E13-89D0-77B9AC4106E3-3HQ/CcOImoi171pxa8y+qA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Claudio Poli @ 2011-09-16  1:43 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

Hello,
I decided to investigate on why rainbows! prints out Invalid argument - setrlimit on Lion.

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.
Then we find this line of code to actually set some value:
    cur <= want and Process.setrlimit(var, cur = max > want ? max : want)

This setrlimit call will do Process.setrlimit(8, 9223372036854775807), Lion bombs out and there's no fallback at least for setting the want value.

Setting Process.setrlimit second argument to the +want+ values works (mine is 406).
It should also be noted that the Process.setrlimit(2..3) call returns nil when successful.
The exact error:
    rainbows-4.3.1/lib/rainbows/http_server.rb:70:in `setrlimit': Invalid argument - setrlimit (Errno::EINVAL)

I rewrote the method a bit, but it doesn't include the fact to set the max value, ever; I understand though that other operating systems might work, so I just leave this report open for thoughts.

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.
--
Claudio
iCoreTech Research Labs - AudioBox.fm
Twitter: http://twitter.com/masterkain

_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: trysetrlimit always raises on Mac OS X
       [not found] ` <2A8DD860-975F-4E13-89D0-77B9AC4106E3-3HQ/CcOImoi171pxa8y+qA@public.gmane.org>
@ 2011-09-16 10:42   ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2011-09-16 10:42 UTC (permalink / raw)
  To: Rainbows! list

Claudio Poli <claudio-3HQ/CcOImoi171pxa8y+qA@public.gmane.org> 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
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-16 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16  1:43 trysetrlimit always raises on Mac OS X Claudio Poli
     [not found] ` <2A8DD860-975F-4E13-89D0-77B9AC4106E3-3HQ/CcOImoi171pxa8y+qA@public.gmane.org>
2011-09-16 10:42   ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).