Locking issues when adding to the Index


I keep getting locking errors when updating my index which puzzles me
since only one process is supposed to be accessing the index at a
time (at least in development mode).

I’m using Ferret with Rails (NOT acts_as_ferret, though) and employed
an observer to add a new document to the index when a new
ActiveRecord is created. I’m not sure if this has any impact on the
concurrency issues, but I thought I mention it.

Find attached the verbatim error message and the relevant part of the
stack trace.

Any ideas?


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

664:in initialize' /usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb: 664:inensure_writer_open’
276:in <<' /usr/lib/ruby/1.8/monitor.rb:229:insynchronize’
254:in <<' /app/models/index.rb:105:inadd’
/app/models/index.rb:20:in after_create' /usr/lib/ruby/gems/1.8/gems/activerecord- active_record/observer.rb:154:inupdate’
/usr/lib/ruby/1.8/observer.rb:185:in `notify_observers’

After careful reconsideration of the facts I eventually came to the
conclusion that closing the index after write operations is good
practice. I can recommend this approach to anyone running into the
same problems.

My apologies for not RTFM.