From: Carol Almquist Date: 2004-05-19T00:24:11+09:00 Subject: Problem using YAML I am using ruby 1.8.1 and yaml to store data records. After a few minutes I get one of the following error messages. /usr/lib/ruby/1.8/yaml.rb:39: [BUG] rb_gc_mark(): unknown data type 0x0(0x40184108) non object ruby 1.8.1 (2003-12-25) [i686-linux] Aborted OR /usr/lib/ruby/1.8/yaml.rb:193: [BUG] Segmentation fault ruby 1.8.1 (2003-12-25) [i686-linux] Aborted I am using two threads to access the data I am writing. Here is my file ... require 'thread' require 'yaml' require 'yaml/store' $dataMutex = Mutex.new class DataClass def initialize( time, device, countOne=0, countTwo=0 ) @time = time @device = device @countOne = countOne @countTwo = countTwo end def getName "device#{@device.to_s}" end def writeInfo begin ext = sprintf( "%2.2d%2.2d%2.2d%2.2d%2.2d%2.2d", @time.year, @time.mon, @time.day, @time.hour, @time.min, @time.sec ) filename = getName + "." + ext store = YAML::Store.new( filename ) print "file: #{filename}\n" store.transaction do store['Device'] = @device store['Time'] = @time store['countOne'] = @countOne store['countTwo'] = @countTwo end rescue => e print "message #{e.message} backtrace #{e.backtrace}" end end end def doThreadOne begin doThreadTwo while true do $dataMutex.synchronize do $dataArray.each do |dataItem| print "ThreadOne: writeInfo\n" dataItem.writeInfo end sleep 0.2 end end rescue => e print "message #{e.message} backtrace #{e.backtrace}" end end def doThreadTwo begin $ThreadTwo = Thread.new do while true do $dataMutex.synchronize do $dataArray.each do |dataItem| print "ThreadTwo: writeInfo\n" dataItem.writeInfo end sleep 0.2 end end end rescue => e print "message #{e.message} backtrace #{e.backtrace}" end end $dataArray = [] begin for channel in 0..23 t = Time.now $dataArray[ channel ] = DataClass.new( t, channel ) end doThreadOne rescue => e end Any suggestions or hints?? Thanks-- Carol Almquist