Incorrect checksum for freed object?

I’m using ferret (0.9.4) in rails, but outside of the “acts_as_ferret”
plugin. Whenever I use a QueryFilter (even a very simple one), the
server
will crash after one, two, or three reloads of a page (same page, same
query, same filter). It’s very non-deterministic and I can’t seem to
reproduce it outside of my application environment (I can’t get it to
fail
in my unit tests).

The error always occurs AFTER my controller method returns (not when I
make
the calls). Also, the error does not always look the same. Sometimes
it
ends in a Bus Error, other times a Segmentation Fault, but always
“incorrect
checksum for freed object”.

This started when I migrated to 0.9.4 from 0.3.2

Thoughts?

Thanks,
Shad


ruby(1895,0xa000ed98) malloc: *** error for object 0x266b1f0: incorrect
checksum for freed object - object was probably modified after being
freed,
break at szone_error to debug
ruby(1895,0xa000ed98) malloc: *** set a breakpoint in szone_error to
debug
ruby(1895,0xa000ed98) malloc: *** error for object 0x266ace0: incorrect
checksum for freed object - object was probably modified after being
freed,
break at szone_error to debug
ruby(1895,0xa000ed98) malloc: *** set a breakpoint in szone_error to
debug
/usr/lib/ruby/1.8/timeout.rb:40: [BUG] Segmentation fault
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]

Abort trap


ruby(1883,0xa000ed98) malloc: *** error for object 0x2198160: incorrect
checksum for freed object - object was probably modified after being
freed,
break at szone_error to debug
ruby(1883,0xa000ed98) malloc: *** set a breakpoint in szone_error to
debug
/usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:148: [BUG]
Bus
Error
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]

Abort trap


I’ve just done some more testing and I’m getting odd behaviour. It
appears there’s some sort of odd race condition. The following code
runs on my machine perfectly (powerbook g4):

def test_index
options = {:dir=>Ferret::Store::FSDirectory.new( $index_dir, false
), :auto_flush=>true}
idx = Ferret::Index::Index.new( options )
begin
query = Ferret::Search::BooleanQuery.new
query.add_query Ferret::Search::TermQuery.new(
Ferret::Index::Term.new( “name”, “type”) )
filter = Ferret::Search::QueryFilter.new( query )

  idx.search_each( "name:type", :filter=>filter ) do |doc,score|
    puts idx[doc]["name"]
  end
ensure
  idx.close
end

end

BUT, If I insert an extra line most anywhere (just before the last
“end” for instance) then I get the following error:


ruby(2776) malloc: *** error for object 0x2679330: incorrect checksum
for freed object - object was probably modified after being freed,
break at szone_error to debug
ruby(2776) malloc: *** set a breakpoint in szone_error to debug

I have not modified the logic of this test case AT ALL, I only added
one extra line. Also, this is reproducable.

  • add extra line: fail, fail, fail
  • remove line: works, works, works
  • add extra line: fail, fail

etc.

Not sure what to do at this point, so I will most likely roll back to
the 0.3.2 version I was using before.

Thanks,
Shad