From: Eric Hodel Date: 2005-11-04T06:17:39+09:00 Subject: Re: DRb recycled objects. On Nov 3, 2005, at 12:41 PM, Kevin Brown wrote: > I started this as a question but figured out the answer while I was > researching, so I'm posting this here for others that may have the > same > problem. > > The error I received from my code was as follows: > > (druby://*:9000) /usr/lib/ruby/1.8/drb/drb.rb:375:in `_id2ref': > 0xdbe53cf6 is > recycled object (RangeError) > > This was happening consistantly from the same place in the code. I > finally > tracked down the line that was giving me grief, and the issue was > that I had > a method called Order#id. When I was running the code without DRb, > this > worked just fine, but calling id on a DRb proxy object will get you > its DRb > object id. I was returning this value, etc. > > I fixed the problem by changing the method name to order_id, so I > know how to > avoid the error, but I would still like a little more explaination > as to why > exactly this occurred so I can get DRb just that much clearer in my > mind. :-) DRb uses the __id__ of the object and the URL of the process it is running on to create a proxy object on other DRb processes. Redefining #id to #object_id probably had nothing to do with fixing your problem. Usually this error comes when a remote DRb process has a reference to an object that was garbage collected before the remote process tried to access it. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04