Error : End-of-File Error occured at <except.c>

Everything was working fine till last night. This morning I have many
errors.
I am using acts_as_ferret. Last updated around a month ago on linux.
There are two different type of exceptions. I have over 12 exception
emails but these are the two distince types.

First exception:

A EOFError occurred in home#event_info:

End-of-File Error occured at <except.c>:79 in xraise
Error occured in store.c:216 - is_refill
current pos = 778, file length = 778

/usr/local/lib/ruby/site_ruby/1.8/ferret/index.rb:517:in `close’

Second exception:
A Ferret::Store::lock::LockError occurred in home#event_info:

Lock Error occured at <except.c>:103 in xpop_context
Error occured in index.c:5372 - iw_open
Couldn’t obtain write lock when opening IndexWriter

/usr/local/lib/ruby/site_ruby/1.8/ferret/index.rb:656:in `initialize’

Try rebuilding your index like the following:

ruby script/console

MyModel.rebuild_index

Charlie

Raj S. wrote:

Everything was working fine till last night. This morning I have many
errors.
I am using acts_as_ferret. Last updated around a month ago on linux.
There are two different type of exceptions. I have over 12 exception
emails but these are the two distince types.

First exception:

A EOFError occurred in home#event_info:

End-of-File Error occured at <except.c>:79 in xraise
Error occured in store.c:216 - is_refill
current pos = 778, file length = 778

/usr/local/lib/ruby/site_ruby/1.8/ferret/index.rb:517:in `close’

Second exception:
A Ferret::Store::lock::LockError occurred in home#event_info:

Lock Error occured at <except.c>:103 in xpop_context
Error occured in index.c:5372 - iw_open
Couldn’t obtain write lock when opening IndexWriter

/usr/local/lib/ruby/site_ruby/1.8/ferret/index.rb:656:in `initialize’

On 10/17/06, Charlie H. [email protected] wrote:

Try rebuilding your index like the following:

ruby script/console

MyModel.rebuild_index

Good advice. Also make sure you have the latest version of Ferret.
Version 0.10.10 will corrupt your index and eventually segfault.

It might sound stupid question but I don’t have an answer. How do I find
what version of ferret is installed on my server.

I couldn’t install ferret on windows and hence I use ferret installed on
the hosting server. Is there a particular command that I could execute
to find what version of Ferret is running or should I ask this question
to the admin at hosting.

Thanks

David B. wrote:

On 10/17/06, Charlie H. [email protected] wrote:

Try rebuilding your index like the following:

ruby script/console

MyModel.rebuild_index

Good advice. Also make sure you have the latest version of Ferret.
Version 0.10.10 will corrupt your index and eventually segfault.

The command is usually

gem list --local

This gives the version of all of the gems, in which ferret should be one
of
them.

Raj S. schrieb:

It might sound stupid question but I don’t have an answer. How do I find
what version of ferret is installed on my server.

I couldn’t install ferret on windows and hence I use ferret installed on
the hosting server. Is there a particular command that I could execute
to find what version of Ferret is running or should I ask this question
to the admin at hosting.

Hey …

There’re several ways… if you installed ferret as gem (the suggested
and default way) try:

benjamin@home ~ $ gem list ferret

*** LOCAL GEMS ***

ferret (0.10.9)
Ruby indexing library.

If you installed it via svn checkout, try this:

benjamin@home ~/trunk $ script/console
Loading development environment.

Ferret::VERSION
=> “0.10.9”

Ben

This problem is back and now I know the pattern.

I rebuilt the index and things started working. Then I started adding
events again to the application. After adding 60/70 events the problem
was back. I got the exception because of

End-of-File Error occured at <except.c>

Then I rebuilt the index and it started working. Again I had the same
issue after I added 50/60 records.

Am I missing something here. I am using ferret 0.10.9 and the latest
acts_as_ferret plugin.

Thanks

Raj S. wrote:

Thanks.

Rebuilding the index solved the problem. I’m running ferret 0.10.9.

-=-Raj

Benjamin K. wrote:

Raj S. schrieb:

It might sound stupid question but I don’t have an answer. How do I find
what version of ferret is installed on my server.

I couldn’t install ferret on windows and hence I use ferret installed on
the hosting server. Is there a particular command that I could execute
to find what version of Ferret is running or should I ask this question
to the admin at hosting.

Hey …

There’re several ways… if you installed ferret as gem (the suggested
and default way) try:

benjamin@home ~ $ gem list ferret

*** LOCAL GEMS ***

ferret (0.10.9)
Ruby indexing library.

If you installed it via svn checkout, try this:

benjamin@home ~/trunk $ script/console
Loading development environment.

Ferret::VERSION
=> “0.10.9”

Ben

Thanks.

Rebuilding the index solved the problem. I’m running ferret 0.10.9.

-=-Raj

Benjamin K. wrote:

Raj S. schrieb:

It might sound stupid question but I don’t have an answer. How do I find
what version of ferret is installed on my server.

I couldn’t install ferret on windows and hence I use ferret installed on
the hosting server. Is there a particular command that I could execute
to find what version of Ferret is running or should I ask this question
to the admin at hosting.

Hey …

There’re several ways… if you installed ferret as gem (the suggested
and default way) try:

benjamin@home ~ $ gem list ferret

*** LOCAL GEMS ***

ferret (0.10.9)
Ruby indexing library.

If you installed it via svn checkout, try this:

benjamin@home ~/trunk $ script/console
Loading development environment.

Ferret::VERSION
=> “0.10.9”

Ben

Raj S. wrote:

This problem is back and now I know the pattern.

I rebuilt the index and things started working. Then I started adding
events again to the application. After adding 60/70 events the problem
was back. I got the exception because of

End-of-File Error occured at <except.c>

Then I rebuilt the index and it started working. Again I had the same
issue after I added 50/60 records.

Am I missing something here. I am using ferret 0.10.9 and the latest
acts_as_ferret plugin.

Thanks

In case anybody comes across this thread…I had a similar problem, but
discovered that is was happening because I was trying to write to my
Model with update_attribute (updating a posting view stat) within the
same method I was running the search from with AAF. The solution for me
was to include a

model.disable_ferret(:once)

statement in the write procedure within my controller action so that AAF
didn’t try to update the index (to a field that didn’t matter anyway,
though I had explicitly excluded it from the :fields array in Model.rb)
while running a search at the same time. So now my code looks like this:

def search
@models = Model.find_by_contents(‘foo’)
@models.each do |m|
@model = Model.find(m.id)
@model.disable_ferret(:once)
@model.update_attribute(‘views’, if @model.views == 0 then 1
else @views + 1 end)
end
end

This also greatly improved my search speed.

You can read more here →
http://projects.jkraemer.net/acts_as_ferret/wiki/AdvancedUsage

Hope this helps someone.

Ooops…

def search
@models = Model.find_by_contents(‘foo’)
@models.each do |m|
@model = Model.find(m.id)
@model.disable_ferret(:once)
@model.update_attribute(‘views’, if @model.views == 0 then 1
else @views + 1 end)
end
end

This also greatly improved my search speed.

You can read more here →
http://projects.jkraemer.net/acts_as_ferret/wiki/AdvancedUsage

Hope this helps someone.

@views in the @model.update_attribute line should be @model.views

Should proof read better :wink: