From: Joel VanderWerf Date: 2003-01-12T13:16:00+09:00 Subject: Re: drb bug? Masatoshi SEKI wrote: > > Hi, Joel. > > On 2003.1.12, at 11:14 AM, Joel VanderWerf wrote: > >> The code I just posted on the client/server observer thread[1] seems >> to expose a drb or ruby bug. It runs fine for about 20-30 seconds, and >> then: > > > I think, its blocks were GCed. > Application should hold reference of Proc object. > > [http://ruby-talk.org/blade/61263] > | ========= client.rb ======= > | > | require 'drb' > | DRb.start_service() > | server = DRbObject.new(nil, 'druby://localhost:9500') > | > | (0..9).each do |i| > | server.register 100*i + i do |val| puts val end > ===================== Proc object > | end > | > | sleep > > for example ... # sorry, it is untested. > > block = Proc.new { |val| puts val } > (0..9).each do |i| > server.register(100*i + 1, &block) > end > Same problem, after this change. But you are right about GC being involved. GC.disable in the client prevents the problem from happening. So something else is getting collected. (Is it possible that the proc is copied internally?)