Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Claudio Poli <claudio-3HQ/CcOImoi171pxa8y+qA@public.gmane.org>
To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: trysetrlimit always raises on Mac OS X
Date: Fri, 16 Sep 2011 03:43:09 +0200	[thread overview]
Message-ID: <2A8DD860-975F-4E13-89D0-77B9AC4106E3@audiobox.fm> (raw)

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


             reply	other threads:[~2011-09-16  9:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16  1:43 Claudio Poli [this message]
     [not found] ` <2A8DD860-975F-4E13-89D0-77B9AC4106E3-3HQ/CcOImoi171pxa8y+qA@public.gmane.org>
2011-09-16 10:42   ` trysetrlimit always raises on Mac OS X Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2A8DD860-975F-4E13-89D0-77B9AC4106E3@audiobox.fm \
    --to=claudio-3hq/ccoimoi171pxa8y+qa@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).