Forum: Ferret acts_as_ferret 0.2.1 segfault

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.
50c077740b9addd55780b91eacbfecac?d=identicon&s=25 John Andrews (Guest)
on 2006-05-23 20:07
(Received via mailing list)
Hi,
I just installed via script/plugin from the stable svn tag. (Revision
54)
I'm running Rails 1.1.2 and have Ferret 0.9.3 (with C extensions. no
compilation problems)

I put together a simple model to test it and I'm getting a segfault.
The model:
class Report < ActiveRecord::Base
  acts_as_ferret :fields => [:title, :name]
end

$ script/console
Loading development environment.
>> a = Report.new :title => "test", :name => "me"
=> #<Report:0xb780db98 @attributes={"name"=>"me", "title"=>"test",
"auto_update"=>true, "path"=>nil}, @new_record=true>
>> a.save
./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:466:
[BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-linux]

vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:466 reads:
self.class.ferret_index << self.to_doc if @ferret_reindex
by inserting logger.debug statements I have been able to determine that
self.to_doc isn't the problem so I think it must be segfaulting during
the
<<.

Does someone know if I have set up something improperly, or is this
truly a
bug?
Thanks,
John
D80de8699b738b9d42978b40ba6d4d11?d=identicon&s=25 Jan Prill (Guest)
on 2006-05-23 21:39
(Received via mailing list)
Hi, John,

my guess is that you have problems with the strings you try to index not
being compliant with the locale of your system. This might be especially
the
case if you retrieve the strings you want to index through ajax.

Please have a look at:

1. http://www.ruby-forum.com/topic/64430
2. http://projects.jkraemer.net/acts_as_ferret/wiki/T... (at
the
bottom)
3. http://ferret.davebalmain.com/trac/ticket/55

maybe you could print the strings to the logfile. if they sound a little
strange like query=%C3%A5&commit=search you definitly should try
different
locale settings.

Regards
Jan
D80de8699b738b9d42978b40ba6d4d11?d=identicon&s=25 Jan Prill (Guest)
on 2006-05-23 21:55
(Received via mailing list)
sorry, I just realised that you already included the request in your
mail.
with 'me' and 'test' there should be no locale problems. If these are
the
strings you are actually using my previous mail won't be of much help...

Have you tried to index something by using ferret without
acts_as_ferret? I
would encourage you to do so by following the short tutorial at
http://ferret.davebalmain.com/api/files/TUTORIAL.html . By doing this
you've
eliminated a 'single point of failure' and you'll find out if it is a
problem of your installation of ferret.

Regards
Jan
50c077740b9addd55780b91eacbfecac?d=identicon&s=25 John Andrews (Guest)
on 2006-05-23 23:26
(Received via mailing list)
On 5/23/06, Jan Prill <jan.prill@gmail.com> wrote:
>
> sorry, I just realised that you already included the request in your mail. with 'me' and 
'test' there should be no locale problems. If these are the strings you are actually using 
my previous mail won't be of much help...

That's right. I have also tried longer strings with no strange
characters such as "accounts payable" and had the same result.

> Have you tried to index something by using ferret without acts_as_ferret? I would 
encourage you to do so by following the short tutorial at 
http://ferret.davebalmain.com/api/files/TUTORIAL.html  . By doing this you've eliminated a 
'single point of failure' and you'll find out if it is a problem of your installation of 
ferret.

I thought I had, but it must have been on my OSX machine. On the
machine in question (Fedora 5) I performed the steps from the
tutorial. Similar result; this time during search instead of insert:
irb(main):002:0> require 'rubygems'
=> true
irb(main):003:0> require 'ferret'
=> true
irb(main):004:0> include Ferret
=> Object
irb(main):005:0> index = Index::Index.new
=> #<Ferret::Index::Index:0xb7cd6524>
irb(main):006:0> index << "this is a new document to be indexed"
=> #<Ferret::Index::Index:0xb7cd6524>
irb(main):007:0> index << ["and here", "is another", "new document",
"to index"]=> #<Ferret::Index::Index:0xb7cd6524>
irb(main):008:0> index << {:title => "Programming Ruby", :content =>
"blah blah blah"}
=> #<Ferret::Index::Index:0xb7cd6524>
irb(main):009:0> index << {:title => "Programming Java", :content =>
"yada yada yada"}
=> #<Ferret::Index::Index:0xb7cd6524>
irb(main):010:0> index.search "document"
(irb):10: [BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-linux]

So my problem lies within ferret. Any ideas what I should try from here?
Thanks for your help
-John
Ca8d935bc3ff2178ebf3d36948cf2b00?d=identicon&s=25 Jordan (Guest)
on 2006-05-24 00:08
I experience the same problem, although it occurs on line 227, since the
indexes are being created for the first time. Strangely enough, it works
perfectly fine on my OSX Laptop, but it dies on our Fedora Core Linux
server. The following is the error I get.

/var/www/project/config/../vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:227:
[BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-linux]

Aborted


John Andrews wrote:
> On 5/23/06, Jan Prill <jan.prill@gmail.com> wrote:
>>
>> sorry, I just realised that you already included the request in your mail. with 'me' 
and 'test' there should be no locale problems. If these are the strings you are actually 
using my previous mail won't be of much help...
>
> That's right. I have also tried longer strings with no strange
> characters such as "accounts payable" and had the same result.
>
>> Have you tried to index something by using ferret without acts_as_ferret? I would 
encourage you to do so by following the short tutorial at 
http://ferret.davebalmain.com/api/files/TUTORIAL.html  . By doing this you've eliminated a 
'single point of failure' and you'll find out if it is a problem of your installation of 
ferret.
>
> I thought I had, but it must have been on my OSX machine. On the
> machine in question (Fedora 5) I performed the steps from the
> tutorial. Similar result; this time during search instead of insert:
> irb(main):002:0> require 'rubygems'
> => true
> irb(main):003:0> require 'ferret'
> => true
> irb(main):004:0> include Ferret
> => Object
> irb(main):005:0> index = Index::Index.new
> => #<Ferret::Index::Index:0xb7cd6524>
> irb(main):006:0> index << "this is a new document to be indexed"
> => #<Ferret::Index::Index:0xb7cd6524>
> irb(main):007:0> index << ["and here", "is another", "new document",
> "to index"]=> #<Ferret::Index::Index:0xb7cd6524>
> irb(main):008:0> index << {:title => "Programming Ruby", :content =>
> "blah blah blah"}
> => #<Ferret::Index::Index:0xb7cd6524>
> irb(main):009:0> index << {:title => "Programming Java", :content =>
> "yada yada yada"}
> => #<Ferret::Index::Index:0xb7cd6524>
> irb(main):010:0> index.search "document"
> (irb):10: [BUG] Segmentation fault
> ruby 1.8.4 (2005-12-24) [i386-linux]
>
> So my problem lies within ferret. Any ideas what I should try from here?
> Thanks for your help
> -John
D80de8699b738b9d42978b40ba6d4d11?d=identicon&s=25 Jan Prill (Guest)
on 2006-05-24 00:16
(Received via mailing list)
And the interlinking element seems to be fedora... For both of you there
are
no problems on osx/freebsd. Installations on ubuntu don't report these
problems and my install on gentoo is fine too. So we need to find out
what's
the problem with fedora.. Are people that are on redhat experiencing the
same problems?

Regards
Jan
Ca8d935bc3ff2178ebf3d36948cf2b00?d=identicon&s=25 Jordan (Guest)
on 2006-05-24 03:39
Jan Prill wrote:
> And the interlinking element seems to be fedora... For both of you there
> are
> no problems on osx/freebsd. Installations on ubuntu don't report these
> problems and my install on gentoo is fine too. So we need to find out
> what's
> the problem with fedora.. Are people that are on redhat experiencing the
> same problems?
>
> Regards
> Jan

I just tried rebuilding ferret with -Os instead of -O0 as was in the
makefile that was generated (i'm sorta new to this whole ruby thing so I
don't know how that gets created). And now it works fine.

So after running
ruby setup.rb config
I went into ext/ modified Makefile, changed -O0 to -Os in the CFLAGS,
and ran make, then went back up a directory and ran
rake setup.rb
and that installed it, and now everything is working just fine.

Jordan
D80de8699b738b9d42978b40ba6d4d11?d=identicon&s=25 Jan Prill (Guest)
on 2006-05-24 08:26
(Received via mailing list)
@Jordan: great, thanks for pointing this out!

@John: does this the trick for you too?

Jan
50c077740b9addd55780b91eacbfecac?d=identicon&s=25 John Andrews (Guest)
on 2006-05-24 14:34
(Received via mailing list)
I followed Jordan's steps and the tests all pass now. Thanks Jordan!
Thanks Jan!
6f7c877de704c7cc03c8a3b2dc52df92?d=identicon&s=25 Carmen --- (carmen)
on 2006-06-02 23:39
John Andrews wrote:
> I followed Jordan's steps and the tests all pass now. Thanks Jordan!
> Thanks Jan!

i get this error as well, with the trunk of acts_as_ferret, and whatever
ferret was installed via gems (0.9.3 i think). watching that install, it
built the C extensions, and the makefile had the systemwide defaults -O2
-pipe. checked out the trunk of ferret, and it refuses to build the C
extensions due to missing header errors (headers from its own files no
less) but at least thats solves the problem, since the segfault is
clearly coming from the C code somewhere.

obviously that doenst help narrow it down much. thanks for the tips
anyways ..
6f7c877de704c7cc03c8a3b2dc52df92?d=identicon&s=25 Carmen --- (carmen)
on 2006-06-02 23:46
the C extension is littered with these warnings:

 warning: cast to pointer from integer of different size

which can be harmless, or not, but ive definitely seen these warnings
gradually disappear from other stuff after running gentoo-amd64 for a
while..


gdb just does this:

Program received signal SIGSEGV, Segmentation fault.
Cannot remove breakpoints because program is no longer writable.
It might be running in another process.
Further execution is probably impossible.
0x00002b670aad0337 in ?? ()

)too lazy to compile ruby with -g to see if its more informative..(

cheers
B5e329ffa0cc78efbfc7ae2d084c149f?d=identicon&s=25 David Balmain (Guest)
on 2006-06-03 01:23
(Received via mailing list)
On 6/3/06, carmen <carmen@whats-your.name> wrote:
> clearly coming from the C code somewhere.
You need to run `rake ext` to copy the missing headers to the right
place. This won't help you with your segfault though.
B5e329ffa0cc78efbfc7ae2d084c149f?d=identicon&s=25 David Balmain (Guest)
on 2006-06-03 01:23
(Received via mailing list)
On 6/3/06, carmen <carmen@whats-your.name> wrote:
> the C extension is littered with these warnings:
>
>  warning: cast to pointer from integer of different size

These will be fixed in a future version. Hopefully the next version.
Dc730e56d34292b3a5c73925cf5a9d39?d=identicon&s=25 ajaya agrawalla (ajay)
on 2006-08-15 22:02
David Balmain wrote:
> On 6/3/06, carmen <carmen@whats-your.name> wrote:
>> the C extension is littered with these warnings:
>>
>>  warning: cast to pointer from integer of different size
>
> These will be fixed in a future version. Hopefully the next version.

I also had the same problem.  Fixed with -0s

aj
This topic is locked and can not be replied to.