Locking issues when adding to the Index

Hi,

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?

Cheers,
Andreas


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

):
/usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb:
664:in initialize' /usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb: 664:inensure_writer_open’
/usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb:
276:in <<' /usr/lib/ruby/1.8/monitor.rb:229:insynchronize’
/usr/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret/index.rb:
254:in <<' /app/models/index.rb:105:inadd’
/app/models/index.rb:20:in after_create' /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4.5263/lib/ 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.

Cheers,
Andy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs