Forum: Ferret How we got rid of a bus error when using acts_as_ferret

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Lukhnos d. L. (Guest)
on 2007-05-16 18:08
Hi,

We have just started using acts_as_ferret, and everything worked well
until we started running into some bus error. The message in mongrel.log
looked like:

  ..../active_support/core_ext/module/inclusion.rb:4: [BUG] Bus Error

We were running on OS X. The same thing happened on Linux, only that the
message was "segmentation fault." That was no good.

After some searching on the web, we found some a few mailing list
threads that described the same situation, but didn't come with any
solution.

Then we tried to zero in, first by removing the :analyzer part, and the
bus error was gone. We started to suspect the analyzer that we were
using:

  :analyzer =>
Ferret::Analysis::RegExpAnalyzer.new(FerretHelper::GENERIC_ANALYSIS_REGEX,
true)

Where GENERIC_ANALYSIS_REGEX is

  /([a-zA-Z]|[\xc0-\xdf][\x80-\xbf])+|[0-9]+|[\xe0-\xef][\x80-\xbf][\x80-\xbf]/

This is used, a la Jcode, to tokenize both European-language words,
numbers, and CJV chars.

Interestingly, we started to suspect if Mongrel's development mode is
the culprit. But anyway, we just created the Analyzer beforehand, and
put it somewhere (say in some lib/helpers/), and now we have something
like:

  acts_as_ferret({:fields => [...] }, { :analyzer =>
FerretHelper::GENERIC_ANALYZER })

And no more bus error / segmentation fault.

We didn't really understand why by sharing the analyzer things went
better off. But I just hope by posting this episode it might help some
people.

Cheers,
d.
This topic is locked and can not be replied to.