I have found another crash in ferret; this one just uses a regular
search. It's similar to an issue reported by Matt Schnitz a while ago,
but unlike his, mine does not go away if I turn off omit_norms. It does
go away if I turn on the garbage collector more often, but I'm not sure
that's a stable workaround under the circumstances.
This one isn't a segfault, but more complicated versions have been. This
bug manifests as a error in the garbage collector:
$ ruby rw_ferret_test.rb
.......rw_ferret_test.rb:20: [BUG] rb_gc_mark(): unknown data type
0x28(0x402ba3a4) non object
ruby 1.8.2 (2005-04-11) [i386-linux]
Aborted
Here's the code:
require 'rubygems'
require 'ferret'
include Ferret
def phrase(num)
"a_fairly_long_phrase%05d"%num
end
LOOPS=(ARGV[1]||40).to_i
_fields = Index::FieldInfos.new
_fields.add_field :phrase, :term_vector => :no, :store => :no, :index =>
:untokenized
$phrases=I.new(:field_infos=>_fields)
phrase(0).upto(phrase(LOOPS)){|phrase| $phrases << {:phrase=> phrase} }
@phrases=Ferret::Search::Searcher.new $phrases.reader
count=0
loop{
@phrases.search(
Search::TermQuery.new(:phrase,
"a_fairly_long_phrase%05d"%rand(LOOPS+1))
)
if ((count+=1)%1000).zero? #1309
print '.'
STDOUT.flush
# GC.start #enable this to workaround
end
}
$phrases.close
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk