Carl Youngblood
2005-Nov-26 19:12 UTC
Ferret on rails--lock doesn''t get released when webrick exits
I''m no doubt doing something wrong here since I just started using ferret. I''m following this tutorial: http://wiki.rubyonrails.com/rails/pages/HowToIntegrateFerretWithRails My ferret_env.rb file looks like this: require ''ferret'' module FerretConfig include Ferret INDEX = Index::Index.new(:path => File.dirname(__FILE__) + ''/../../searchindex'') end When I load webrick for the first time, everything works fine. But when I exit with ctrl-c and try to load it again, I get this: => Booting WEBrick... /usr/lib/ruby/gems/1.8/gems/ferret-0.2.2/lib/ferret/store/fs_store.rb:226:in `obtain'': could not obtain lock: ./script/../config/../config/environments/../../searchindex/ferret-a214f46c3947bc95b17cb835bf48ae91write.lock (RuntimeError) from /usr/lib/ruby/gems/1.8/gems/ferret-0.2.2/lib/ferret/index/index_writer.rb:99:in `initialize'' ... Is there anything I can do to cause the lock to be released when webrick exits? Thanks, Carl
Anatol Pomozov
2005-Nov-26 19:38 UTC
Re: Ferret on rails--lock doesn''t get released when webrick exits
In Ferret_environment.rb I have added following line Dir["#{FT_PATH}/**/*.lock"].each{|f| File.unlink f} Just remove all *.lock files on startup. I am not sure that it is the best solution, but it works for me. On 11/26/05, Carl Youngblood <carl-MJzSGySFh6ZUfOvSQQQpYw@public.gmane.org> wrote:> > I''m no doubt doing something wrong here since I just started using > ferret. I''m following this tutorial: > > http://wiki.rubyonrails.com/rails/pages/HowToIntegrateFerretWithRails > > My ferret_env.rb file looks like this: > > require ''ferret'' > module FerretConfig > include Ferret > > INDEX = Index::Index.new(:path => File.dirname(__FILE__) + > ''/../../searchindex'') > end > > When I load webrick for the first time, everything works fine. But > when I exit with ctrl-c and try to load it again, I get this: > > => Booting WEBrick... > /usr/lib/ruby/gems/1.8/gems/ferret-0.2.2 > /lib/ferret/store/fs_store.rb:226:in > `obtain'': could not obtain lock: > ./script/../config/../config/environments/../../searchindex/ferret- > a214f46c3947bc95b17cb835bf48ae91write.lock > (RuntimeError) > from /usr/lib/ruby/gems/1.8/gems/ferret-0.2.2 > /lib/ferret/index/index_writer.rb:99:in > `initialize'' > ... > > Is there anything I can do to cause the lock to be released when webrick > exits? > > Thanks, > Carl > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- anatol (http://pomozov.info) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Jan Prill
2005-Nov-27 00:31 UTC
Re: Ferret on rails--lock doesn''t get released when webrick exits
Hi, Carl, please have a look at http://article.gmane.org/gmane.comp.lang.ruby.rails/26859 and use the approach that luke describes. This is favorable to the approach that I''ve described in the tutorial. You might also have a look at http://ferret.davebalmain.com/trac/ticket/6 regards Jan Prill Carl Youngblood wrote:>I''m no doubt doing something wrong here since I just started using >ferret. I''m following this tutorial: > >http://wiki.rubyonrails.com/rails/pages/HowToIntegrateFerretWithRails > >My ferret_env.rb file looks like this: > >require ''ferret'' >module FerretConfig > include Ferret > > INDEX = Index::Index.new(:path => File.dirname(__FILE__) + >''/../../searchindex'') >end > >When I load webrick for the first time, everything works fine. But >when I exit with ctrl-c and try to load it again, I get this: > >=> Booting WEBrick... >/usr/lib/ruby/gems/1.8/gems/ferret-0.2.2/lib/ferret/store/fs_store.rb:226:in >`obtain'': could not obtain lock: >./script/../config/../config/environments/../../searchindex/ferret-a214f46c3947bc95b17cb835bf48ae91write.lock >(RuntimeError) > from /usr/lib/ruby/gems/1.8/gems/ferret-0.2.2/lib/ferret/index/index_writer.rb:99:in >`initialize'' >... > >Is there anything I can do to cause the lock to be released when webrick exits? > >Thanks, >Carl >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >