From: James Edward Gray II Date: 2005-11-17T00:49:58+09:00 Subject: Re: DRb Crashing On Nov 16, 2005, at 9:42 AM, Hugh Sasse wrote: > On Thu, 17 Nov 2005, James Edward Gray II wrote: > > >> On Nov 15, 2005, at 6:50 PM, Hugh Sasse wrote: >> >> >>> On Wed, 16 Nov 2005, James Edward Gray II wrote: >>> >>> >>> >>>> If I launch this server: >>>> >>>> >>> [...] >>> >>> >>>> __END__ >>>> >>>> Then run this client: >>>> >>>> #!/usr/local/bin/ruby -w >>>> >>>> require "drb" >>>> require "rinda/tuplespace" >>>> >>>> DRb.start_service >>>> tuplespace = Rinda::TupleSpaceProxy.new( >>>> DRbObject.new_with_uri("druby://localhost:61676") >>>> ) >>>> >>>> while problem = tuplespace.take(["Problem", %r{^\d+(?: [-+*/] \d >>>> +)+$}]) >>>> tuplespace.write(["Result", "#{problem.last} = #{eval >>>> problem.last}"]) >>>> end >>>> >>>> __END__ >>>> >>>> The client crashes, generally within a few seconds. Adding a >>>> sleep inside >>>> the >>>> server loop seems to resolve the issue. >>>> >>>> Anyone know why? >>>> >>>> >>> >>> No, I don't. What happens if you match the old way? Like: >>> while problem = tuplespace.take(["Problem", nil]) >>> >> >> The Regexp is pretty critical in this case. It validates the data >> before an >> otherwise dangerous call to eval(). >> > > while problem = tuplespace.take(["Problem", nil]) > unless problem.last =~ %r{^\d+(?: [-+*/] \d+)+$} > puts "Bogus input \'#{problem.last}\', Ted!" #:-) > else > tuplespace.write(["Result", "#{problem.last} = #{eval > problem.last}"]) > end > end This is not equivalent. You removed the problem from the TupleSpace whereas my version leaves it for someone else to solve. I realize this isn't what you were originally asking for and I can try the change, if you want to see it. To me it's irrelevant though, because TupleSpace supports a Regexp search and it should not be crashing when doing it. This is just a simplified case I cooked up to show the issue. James Edward Gray II