Ferret failing to rebuild_index - occasionally unable to del


#1

I’m switching all my fulltext searching over to ferret using the
acts_as_ferret plugin on windows (for development, will be deployed on
linux).

In my tests I have a setup method as follows to ensure the index is
reset for each test:

def setup
Item.rebuild_index
end

This works fine for the initial few tests but then suddenly fails for
the last few tests when it seems to be failing to delete a file.

Loaded suite E:/rails/thatsprogress/test/unit/item_test
Started
…EEEE
Finished in 8.922 seconds.

  1. Error:
    test_search_for_count(ItemTest):
    Errno::EACCES: Permission denied -
    E:/rails/thatsprogress/config/…/index/test/Item/_j.cfs

Full trace included later.

It consistantly does it at this point, and looks like something is
stopping _j.cfs from being deleted.

Any ideas on what’s going on and how to stop it?

Thanks in advance.

Full trace is as follows:

Loaded suite E:/rails/thatsprogress/test/unit/item_test
Started
…EEEE
Finished in 8.922 seconds.

  1. Error:
    test_search_for_count(ItemTest):
    Errno::EACCES: Permission denied -
    E:/rails/thatsprogress/config/…/index/test/Item/_j.cfs

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:105:in
`delete’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:105:in
`refresh’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:104:in
`each’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:123:in
`each’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:123:in
`each’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:104:in
`refresh’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:101:in
`synchronize’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:101:in
`refresh’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:74:in
`new’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:68:in
`synchronize’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/store/fs_store.rb:68:in
`new’

D:/programming/ruby/lib/ruby/gems/1.8/gems/ferret-0.9.1/lib/ferret/index/index.rb:133:in
`initialize’

E:/rails/thatsprogress/config/…/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:223:in
`new’

E:/rails/thatsprogress/config/…/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:223:in
rebuild_index' E:/rails/thatsprogress/test/unit/item_test.rb:15:insetup_without_fixtures’

E:/rails/thatsprogress/config/…/vendor/rails/activerecord/lib/active_record/fixtures.rb:554:in
`setup’

E:/rails/thatsprogress/config/…/vendor/rails/activerecord/lib/active_record/fixtures.rb:552:in
`setup’


R.Livsey
http://livsey.org


#2

I have looked at this problem recently but didn’t solve it entirely. I
suspect that windows is not releasing the files soon enough for the next
test to work on them.

This post might offer some insight
http://www.talkaboutprogramming.com/group/comp.lang.ruby/messages/78404.html

Kasper

Loaded suite E:/rails/thatsprogress/test/unit/item_test
Started
…EEEE
Finished in 8.922 seconds.

  1. Error:
    test_search_for_count(ItemTest):
    Errno::EACCES: Permission denied -
    E:/rails/thatsprogress/config/…/index/test/Item/_j.cfs

#3

Most of the tests also fail on Windows with a similar error on the demo
provided in svn. I tried adding some sleeps but that doesn’t make a
difference.

Kasper W. wrote:

I have looked at this problem recently but didn’t solve it entirely. I
suspect that windows is not releasing the files soon enough for the next
test to work on them.

This post might offer some insight
http://www.talkaboutprogramming.com/group/comp.lang.ruby/messages/78404.html

Kasper

Loaded suite E:/rails/thatsprogress/test/unit/item_test
Started
…EEEE
Finished in 8.922 seconds.

  1. Error:
    test_search_for_count(ItemTest):
    Errno::EACCES: Permission denied -
    E:/rails/thatsprogress/config/…/index/test/Item/_j.cfs

#4

This problem seems to have been solved with ferret 0.9.2

Kasper W. wrote:

I think windows is locking the file for deletion until the test process
ends - or something similar.

akb wrote:

Most of the tests also fail on Windows with a similar error on the demo
provided in svn. I tried adding some sleeps but that doesn’t make a
difference.


#5

I think windows is locking the file for deletion until the test process
ends - or something similar.

akb wrote:

Most of the tests also fail on Windows with a similar error on the demo
provided in svn. I tried adding some sleeps but that doesn’t make a
difference.


#6

Unfortunately I still see this problem with both 0.9.2 and 0.9.3.

a

Kasper W. wrote:

This problem seems to have been solved with ferret 0.9.2

Kasper W. wrote:

I think windows is locking the file for deletion until the test process
ends - or something similar.

akb wrote:

Most of the tests also fail on Windows with a similar error on the demo
provided in svn. I tried adding some sleeps but that doesn’t make a
difference.