From: jbshaldane@... (haldane) Date: 2004-07-01T22:02:50+09:00 Subject: Re: YAML BUG > Does anyone know why this program causes YAML to go into an infinite > loop until it runs out of stack? > > http://194.100.133.72/rubytest/t.rb.txt I have a much shorter example now: require 'yaml' class A attr_accessor :b,:c def initialize @f = "h" * 2000 @g = $x end end $x = A.new a = A.new a.b = A.new a.b.b = A.new a.b.c = a # yaml goes into an infinite loop y a My theory is that yaml keeps a track of objects, and only assigns them an id number if it sees the object for the second time (in emitter.c). If it does this, it tries to go back and write that id where the object first occurred. But if the 4k buffer has already been exceeded and flushed, then the id cannot be written, and the whole object is written out again. Causing an infinite loop. This is a serious problem. If my theory is right, I guess it could be fixed by always writing an id for every object in the expectation that it may be met again? _why: any comments? Stephen Sykes