# Making acts\_as\_ferret thread safe?

**URL:** <https://www.ruby-forum.com/t/making-acts-as-ferret-thread-safe/83017>\
**Category:** Ferret\
**Created:** [January 23, 2007, 1:47am UTC](https://www.ruby-forum.com/t/making-acts-as-ferret-thread-safe/83017 "2007-01-23T01:47:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5ac83/32.png) [@erik](https://www.ruby-forum.com/u/erik)\
**Post date:** [January 23, 2007, 1:47am UTC](https://www.ruby-forum.com/t/making-acts-as-ferret-thread-safe/83017/1 "2007-01-23T01:47:21Z")

</div>

Hi

I get a synchronize error (see below) when I run a lib script with  
script/runner.

The script updates a status field in a model object that is indexed and  
searchable within the script/server (mongrel) process.

$ script/runner -e production ‘load “lib/billing/credit\_subscribers.rb”’  
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/runner.rb:27:  
IOError (IOError)  
from  
/usr/lib/ruby/gems/1.8/gems/ferret-0.10.14/lib/ferret/index.rb:124:in  
`initialize' from /usr/lib/ruby/1.8/monitor.rb:229:in`synchronize’  
from  
/usr/lib/ruby/gems/1.8/gems/ferret-0.10.14/lib/ferret/index.rb:122:in  
`initialize' from ./script/../config/../vendor/plugins/acts_as_ferret/lib/class_methods.rb:240:in`create\_index\_instance’  
from  
./script/…/config/…/vendor/plugins/acts\_as\_ferret/lib/class\_methods.rb:232:in  
`ferret_index' from ./script/../config/../vendor/plugins/acts_as_ferret/lib/instance_methods.rb:88:in`ferret\_update’  
from  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/callbacks.rb:344:in  
`callback' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:341:in`callback’  
… 16 levels…  
from  
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/runner.rb:27  
from  
/usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:27:in `require' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in`require’  
from script/runner:3

I’m guessing this is a lock contention issue, is it possible to  
cordinate the locking performed by the plugin ?

Erik

---

<div class="post-metadata">

**Author:** ![erik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5ac83/32.png) [@erik](https://www.ruby-forum.com/u/erik)\
**Post date:** [January 23, 2007, 10:51am UTC](https://www.ruby-forum.com/t/making-acts-as-ferret-thread-safe/83017/2 "2007-01-23T10:51:32Z")

</div>

On Tue, Jan 23, 2007 at 01:47:21AM +0100, Erik wrote:

> IOError (IOError)  
> from  
> /usr/lib/ruby/gems/1.8/gems/ferret-0.10.14/lib/ferret/index.rb:124:in  
> `initialize’

that line does just check for the existence of the segments file inside  
the index directory, maybe it’s just a file system permissions issue?

Jens

–  
webit! Gesellschaft für neue Medien mbH [www.webit.de](http://www.webit.de)  
Dipl.-Wirtschaftsingenieur Jens Krämer removed\_email\_address@domain.invalid  
Schnorrstraße 76 Tel +49 351 46766 0  
D-01069 Dresden Fax +49 351 46766 66

---

<div class="post-metadata">

**Author:** ![erik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/b5ac83/32.png) [@erik](https://www.ruby-forum.com/u/erik)\
**Post date:** [January 23, 2007, 11:14pm UTC](https://www.ruby-forum.com/t/making-acts-as-ferret-thread-safe/83017/3 "2007-01-23T23:14:50Z")

</div>

Jens K. wrote:

> that line does just check for the existence of the segments file inside  
> the index directory, maybe it’s just a file system permissions issue?
> 
> Jens

That was the problem, thank you!
