From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=0.0 required=3.0 tests=MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Claudio Poli Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: trysetrlimit always raises on Mac OS X Date: Fri, 16 Sep 2011 03:43:09 +0200 Message-ID: <2A8DD860-975F-4E13-89D0-77B9AC4106E3@audiobox.fm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1316166447 27482 80.91.229.12 (16 Sep 2011 09:47:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 16 Sep 2011 09:47:27 +0000 (UTC) To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Fri Sep 16 11:47:22 2011 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Virus-Scanned: amavisd-new at studiomanfredini.it X-Mailer: Apple Mail (2.1244.3) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:297 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R4V0x-0003hS-2T for gclrrg-rainbows-talk@m.gmane.org; Fri, 16 Sep 2011 11:47:19 +0200 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id BD91A121827C; Fri, 16 Sep 2011 05:47:17 -0400 (EDT) Received: from aa011-1msr.fastwebnet.it (aa011-1msr.fastwebnet.it [62.101.93.131]) by rubyforge.org (Postfix) with ESMTP id CC79D121827A for ; Fri, 16 Sep 2011 04:19:39 -0400 (EDT) Received: from mail.studiomanfredini.it (93.62.245.136) by aa011-1msr.fastwebnet.it (8.5.016.6) id 4E38F8AB02B6358F for rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org; Fri, 16 Sep 2011 03:43:15 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.studiomanfredini.it (Postfix) with ESMTP id 14D92380405A for ; Fri, 16 Sep 2011 03:43:15 +0200 (CEST) Received: from mail.studiomanfredini.it ([127.0.0.1]) by localhost (mainframe.studiomanfredini.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tLXbpgdvbNwe for ; Fri, 16 Sep 2011 03:43:10 +0200 (CEST) Received: from [192.168.5.102] (unknown [151.64.233.79]) by mail.studiomanfredini.it (Postfix) with ESMTPSA id 676423804045 for ; Fri, 16 Sep 2011 03:43:10 +0200 (CEST) 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