# DRb Problems with Mac OS X 10.5.3

**URL:** <https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922>\
**Category:** Ruby\
**Created:** [May 29, 2008, 12:18am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922 "2008-05-29T00:18:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 12:18am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/1 "2008-05-29T00:18:29Z")

</div>

It looks like the Mac OS X 10.5.3 upgrade breaks DRb when it’s trying to  
open a TCPSocket.

Looking into it now, but be warned:

/opt/local/lib/ruby/1.8/drb/drb.rb:865:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in`open’  
from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open\_server’

-Kurt

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 1:22am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/2 "2008-05-29T01:22:30Z")

</div>

I’m running into the same problem too having just upgraded. Is there a  
solution?

Eric

Kurt Schrader wrote:

> It looks like the Mac OS X 10.5.3 upgrade breaks DRb when it’s trying to  
> open a TCPSocket.
> 
> Looking into it now, but be warned:
> 
> /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open’  
> from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open\_server’
> 
> -Kurt

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 2:03am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/3 "2008-05-29T02:03:13Z")

</div>

No solution yet, but it looks like something has changed in some  
underlying networking library, as base socket handing methods seem to be  
broken:

[kschrader@einstein:~]$ irb

> > require ‘socket’  
> > =\> true  
> > Socket.getaddrinfo(Socket.gethostname, 0, Socket::AF\_INET, Socket::SOCK\_STREAM, nil, Socket::AI\_CANONNAME)  
> > SocketError: getaddrinfo: nodename nor servname provided, or not known  
> > from (irb):2:in `getaddrinfo’  
> > from (irb):2

Eric Ly wrote:

> I’m running into the same problem too having just upgraded. Is there a  
> solution?
> 
> Eric
> 
> Kurt Schrader wrote:
> 
> > It looks like the Mac OS X 10.5.3 upgrade breaks DRb when it’s trying to  
> > open a TCPSocket.
> > 
> > Looking into it now, but be warned:
> > 
> > /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open’  
> > from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open\_server’
> > 
> > -Kurt

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 2:40am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/4 "2008-05-29T02:40:53Z")

</div>

Kurt Schrader wrote:

> No solution yet, but it looks like something has changed in some  
> underlying networking library, as base socket handing methods seem to be  
> broken:

Damn, I need a fix bad – Either that or I’m re-installing my entire OS  
X machine to get rid of 10.5.3.

I’ll help anyway I can, but I’m not good with the underlyings.

Please let us know as soon as you find something.

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 8:01am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/5 "2008-05-29T08:01:43Z")

</div>

Thanks for the report, we are of course very sorry about that. Ruby  
didn’t change in Mac OS X 10.5.3, so we are currently investigating  
possible regressions in the underlying frameworks. We will let you  
know.

Following Andy’s idea, what about the following as a temporary fix?  
Seems to work for DRb servers with a port of 0 (which seems to be the  
default). Apparently DRb servers which explicitly bind to a non 0 port  
are not affected by this regression.

class DRb::DRbTCPSocket  
class \<\< self  
alias parse\_uri\_orig parse\_uri  
def parse\_uri(\*args)  
ary = parse\_uri\_orig(\*args)  
ary[1] = nil if ary[1] == 0  
ary  
end  
end  
end

Laurent

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 7:11am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/6 "2008-05-29T07:11:12Z")

</div>

I’ve not done too much Ruby socket programming, but it seems to be that  
it doesn’t like 0 as a service number, because it is interpreting it as  
the real service 0, instead of the empty service… if you use nil  
instead it works fine… you might be able to patch dRb to use that as a  
work around.

irb(main):001:0\> require ‘socket’  
=\> true  
irb(main):011:0\> Socket.getaddrinfo(Socket.gethostname, 0,  
Socket::AF\_INET, Socket::SOCK\_STREAM, nil, Socket::AI\_CANONNAME)  
SocketError: getaddrinfo: nodename nor servname provided, or not known  
from (irb):11:in `getaddrinfo’  
from (irb):11  
from :0  
irb(main):012:0\> Socket.getaddrinfo(Socket.gethostname, nil,  
Socket::AF\_INET, Socket::SOCK\_STREAM, nil, Socket::AI\_CANONNAME)  
=\> [[“AF\_INET”, 0, “192.168.1.95”, “192.168.1.95”, 2, 1, 6]]

Kurt Schrader wrote:

> No solution yet, but it looks like something has changed in some  
> underlying networking library, as base socket handing methods seem to be  
> broken:
> 
> [kschrader@einstein:~]$ irb
> 
> > > require ‘socket’  
> > > =\> true  
> > > Socket.getaddrinfo(Socket.gethostname, 0, Socket::AF\_INET, Socket::SOCK\_STREAM, nil, Socket::AI\_CANONNAME)  
> > > SocketError: getaddrinfo: nodename nor servname provided, or not known  
> > > from (irb):2:in `getaddrinfo’  
> > > from (irb):2
> 
> Eric Ly wrote:
> 
> > I’m running into the same problem too having just upgraded. Is there a  
> > solution?
> > 
> > Eric
> > 
> > Kurt Schrader wrote:
> > 
> > > It looks like the Mac OS X 10.5.3 upgrade breaks DRb when it’s trying to  
> > > open a TCPSocket.
> > > 
> > > Looking into it now, but be warned:
> > > 
> > > /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open’  
> > > from /opt/local/lib/ruby/1.8/drb/drb.rb:865:in `open\_server’
> > > 
> > > -Kurt

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 8:36am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/7 "2008-05-29T08:36:30Z")

</div>

Laurent,

That seems to work for now. Thanks for looking into it.

-Kurt

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 9:58am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/8 "2008-05-29T09:58:06Z")

</div>

Laurent S. wrote:

> class DRb::DRbTCPSocket  
> class \<\< self  
> alias parse\_uri\_orig parse\_uri  
> def parse\_uri(\*args)  
> ary = parse\_uri\_orig(\*args)  
> ary[1] = nil if ary[1] == 0  
> ary  
> end  
> end  
> end

Where does this wonderful piece of code go?

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 10:07am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/9 "2008-05-29T10:07:32Z")

</div>

I put this just before “Rails::Initializer.run(:set\_load\_path)” in  
config/boot.rb

=======

# HACK

# require ‘drb’ class DRb::DRbTCPSocket class \<\< self alias parse\_uri\_orig parse\_uri def parse\_uri(\*args) ary = parse\_uri\_orig(\*args) ary[1] = nil if ary[1] == 0 ary end end end

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 6:15pm UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/10 "2008-05-29T18:15:40Z")

</div>

Blaz Rubi wrote:

> I put this just before “Rails::Initializer.run(:set\_load\_path)” in  
> config/boot.rb
> 
> =======
> 
> # HACK
> 
> # require ‘drb’ class DRb::DRbTCPSocket class \<\< self alias parse\_uri\_orig parse\_uri def parse\_uri(\*args) ary = parse\_uri\_orig(\*args) ary[1] = nil if ary[1] == 0 ary end end end

Incase you get errors and cannot get the hack above, try putting it in  
the environment.rb file INSIDE the config block.

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 29, 2008, 5:13pm UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/11 "2008-05-29T17:13:28Z")

</div>

Blaz Rubi wrote:

> I put this just before “Rails::Initializer.run(:set\_load\_path)” in  
> config/boot.rb
> 
> =======
> 
> # HACK
> 
> # require ‘drb’ class DRb::DRbTCPSocket class \<\< self alias parse\_uri\_orig parse\_uri def parse\_uri(\*args) ary = parse\_uri\_orig(\*args) ary[1] = nil if ary[1] == 0 ary end end end

Anyone else get errors from inserting this code?

if you place it in the LINE before  
“Rails::Initializer.run(:set\_load\_path)” I got a syntax error

script/server:2:in `require’: ./script/../config/boot.rb:41: class  
definition in method body (SyntaxError)  
from script/server:2

which makes sense.

if you place it outside of the Boot Class you get a SystemStackError

./script/../config/boot.rb:43:in `parse_uri_orig': stack level too deep (SystemStackError) from ./script/../config/boot.rb:43:in `parse\_uri\_orig’  
from /Users/lorgio/Sites/gawkk/config/boot.rb:43:in `parse_uri' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/drb.rb:874:in `uri\_option’  
from  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/drb.rb:780:in  
`uri_option' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/drb.rb:778:in `each’  
from  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/drb.rb:778:in  
`uri_option' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/drb.rb:1044:in `initialize’  
from  
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action\_controller/session/drb\_store.rb:8:in  
`new' ... 51 levels... from /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem\_original\_require’  
from /Library/Ruby/Site/1.8/rubygems/custom\_require.rb:27:in `require’  
from script/server:3

Anyone get this working?  
Am I placing this in the wrong place? or is there something I missed?

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 30, 2008, 2:21am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/12 "2008-05-30T02:21:29Z")

</div>

Lorgio Jimenez wrote:

> Incase you get errors and cannot get the hack above, try putting it in  
> the environment.rb file INSIDE the config block.

Yeah that doesn’t work either.

A) INSIDE config block of environment.rb,

B) Before the “Rails::Initializer.run(:set\_load\_path)” line in boot.rb.

Neither A or B work.

Any other ideas?

./script/../config/boot.rb:48: uninitialized constant DRb (NameError)  
from script/server:2:in `require’  
from script/server:2

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [May 30, 2008, 3:18am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/13 "2008-05-30T03:18:27Z")

</div>

Jeff Sidlosky wrote:

> ./script/../config/boot.rb:48: uninitialized constant DRb (NameError)  
> from script/server:2:in `require’  
> from script/server:2

You forgot to require DRb.  
Add require ‘drb’ right above the code.

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [June 4, 2008, 8:22pm UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/14 "2008-06-04T20:22:19Z")

</div>

I had the same problems and this fix makes it possible for mongrel to  
start and I thought everything was fine.

But, I can’t seem to run any background tasks using backgroundrb.

I get

The error occurred while evaluating nil.object - (NoMethodError)  
20080604-13:35:57 (4356)  
vendor/plugins/backgroundrb/server/lib/backgroundrb/middleman.rb:396:in  
`worker’

Line 396 is:  
worker = ex { @jobs[key].object }

Anyone else having trouble?

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [June 5, 2008, 9:11pm UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/15 "2008-06-05T21:11:07Z")

</div>

Davis K. wrote:

> Anyone else having trouble?

Yes. I’m having problems with backgroundrb too, even with the hack.

I’m running Ruby out of MacPorts and it looks like a lot of others in  
this thread are too.

Is this a problem for those running the version of Ruby included with  
Mac OS X as well? Looks like Lorgio Jimenez was running into some  
problems using Mac OS X’s Ruby.

Does anyone know if/when this is going to be fixed?

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [June 6, 2008, 3:08pm UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/16 "2008-06-06T15:08:48Z")

</div>

I just thought I’d tell people what I ended up doing to solve the  
problem so that they might avoid some of the problems I ran into.

I downgraded to 10.5.0 via my leopard install cd using the preserve  
perferences option.

I was hoping it’d leave everything the same, just downgrade the system,  
so all my filesystems would be intact (/usr/local/src, bin etc etc.)

Wrong assumption. They were scattered all over a folder that was  
created called “Previous System”

At first I thought I could piece it all together, but no way!. It was  
like a bomb went off and scattered my development environment all over  
the place with no discernible logic.

So

I rebuilt my whole environment from scratch - gems, mysql, ruby, rails,  
subversion etc etc etc.

Total nightmare.

If you can find a way to patch the problem until apple fixes it - do.

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [June 6, 2008, 9:02am UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/17 "2008-06-06T09:02:02Z")

</div>

Ryan Duryea wrote:

Well, I went and got some answers to my own questions!

> Is this a problem for those running the version of Ruby included with  
> Mac OS X as well?

Sure seems like it. Check this out:

% /usr/bin/ruby.orig -v  
ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]

% /usr/bin/ruby.orig -r socket -e “TCPServer.open(‘localhost’, 0)”  
-e:1:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) from -e:1:in `open’  
from -e:1

> Does anyone know if/when this is going to be fixed?

Keep in mind that I have almost no experience with socket programming,  
but I have submitted a patch for MacPorts under this ticket. Use at  
your own peril! It seems to work for me, but your mileage may vary!

> **[\#15528 (ruby @1.8.6-p114 patch to get Ruby's Socket classes to work with...](https://trac.macports.org/ticket/15528)**

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [June 7, 2008, 6:36pm UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/18 "2008-06-07T18:36:56Z")

</div>

Jeff Sidlosky wrote:

> Lorgio Jimenez wrote:
> 
> > Incase you get errors and cannot get the hack above, try putting it in  
> > the environment.rb file INSIDE the config block.
> 
> Yeah that doesn’t work either.
> 
> A) INSIDE config block of environment.rb,
> 
> B) Before the “Rails::Initializer.run(:set\_load\_path)” line in boot.rb.
> 
> Neither A or B work.
> 
> Any other ideas?
> 
> ./script/../config/boot.rb:48: uninitialized constant DRb (NameError)  
> from script/server:2:in `require’  
> from script/server:2

I put it in environment.rb _outside_ of the config block and it works  
like a champ.

What a drag – why didn’t I hear about this at RailsConf?

Wes

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [July 16, 2008, 12:42pm UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/19 "2008-07-16T12:42:04Z")

</div>

Having lots of problems with this bug. Tried some of the fixes suggested  
in this thread but with no luck. Any idea when we might be getting a  
fix?

---

<div class="post-metadata">

**Author:** ![kschrader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/919ad9/32.png) [@kschrader](https://www.ruby-forum.com/u/kschrader)\
**Post date:** [July 16, 2008, 1:25pm UTC](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922/20 "2008-07-16T13:25:03Z")

</div>

Apple fixed the DRb problem in the 10.5.4 update, which was released at  
the  
end of June.

[http://www.macruby.org/post/47/](http://www.macruby.org/post/47/)

Craig

[Next page](https://www.ruby-forum.com/t/drb-problems-with-mac-os-x-10-5-3/138922.md?page=2)
