Forum: Ruby DRb throws Errno::EMFILE "Too many open files" with 256 conn

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
47f0c9aabba71e7b993dafc50e1d8757?d=identicon&s=25 unknown (Guest)
on 2007-07-27 22:45
(Received via mailing list)
Hi,

I have a ruby / DRb process that is quiting with Errno::EMFILE every
time it reaches 256 connections. This happens regardless of what I set
in ulimit -n and only on Solaris.

/opt/csw/lib/ruby/1.8/drb/drb.rb:944:in `accept': Too many open files
(Errno::EMFILE)
        from /opt/csw/lib/ruby/1.8/drb/drb.rb:944:in `accept'
        from /opt/csw/lib/ruby/1.8/drb/drb.rb:1581:in `main_loop'
        from /opt/csw/lib/ruby/1.8/drb/drb.rb:1430:in `run'
        from /opt/csw/lib/ruby/1.8/drb/drb.rb:1427:in `start'
        from /opt/csw/lib/ruby/1.8/drb/drb.rb:1427:in `run'
        from /opt/csw/lib/ruby/1.8/drb/drb.rb:1347:in `initialize'
        from /opt/csw/lib/ruby/1.8/drb/drb.rb:1627:in `new'
        from /opt/csw/lib/ruby/1.8/drb/drb.rb:1627:in `start_service'
        from ./tuple_space.sh:10


I also tried this test both in OSX and Solaris:

 255.times {a<<File.open("/etc/hosts")}

and I got it working on OSX with a ulimit -n 2048 but it seems that
Ruby on Solaris does not change its behavior based on ulimit -n and it
still throws:

Errno::EMFILE: Too many open files - /etc/hosts
        from (irb):17:in `initialize'
        from (irb):17:in `open'
        from (irb):17
        from (irb):17:in `times'
        from (irb):17


Anyone has any insight on how to get Solaris to open more than 256
files?

Thanks in advance.
Fa273befbb36b0323044fcf035b7ee39?d=identicon&s=25 Blaine Cook (Guest)
on 2007-07-28 11:40
(Received via mailing list)
As it turns out, I was having this problem until your post made me
realize that it was solaris (and not my program, as I had assumed).
Some research turn this up:

http://developers.sun.com/solaris/articles/stdio_256.html

which says that 32-bit applications are limited to 256 file
descriptors when running under Solaris, unless you do the following:

export LD_PRELOAD_32=/usr/lib/extendedFILE.so.1

before running your program. Ruby on Solaris is a 32 bit app (we've
never had it compile cleanly as a 64 bit application), so this makes
sense. Except for the part about the limit of 256 file descriptors.
But oh well!

cheers,

b.
47f0c9aabba71e7b993dafc50e1d8757?d=identicon&s=25 unknown (Guest)
on 2007-08-01 04:11
(Received via mailing list)
On Jul 28, 6:38 am, Blaine Cook <rom...@gmail.com> wrote:
>
> > Hi,
> >         from /opt/csw/lib/ruby/1.8/drb/drb.rb:1427:in `start'
> > and I got it working on OSX with a ulimit -n 2048 but it seems that
> > Anyone has any insight on how to get Solaris to open more than 256
> > files?
>
> > Thanks in advance.

Thanks Blaine, .. this works !!.
This topic is locked and can not be replied to.