dougal / acts_as_indexed

Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app
http://douglasfshearer.com/blog/rails-plugin-acts_as_indexed
MIT License
211 stars 49 forks source link

Access file problems on Windows #39

Closed kpymkata closed 12 years ago

kpymkata commented 12 years ago

Hi folks,

I am having an unexpected behavior of the gem under Windows. My environment is: 64-bit Window 7, 64-bit Sun JDK 1.6.0_37, 64-bit JRuby 1.6.8, Rails 3.2.2, acts_as_indexed 0.7.8, devise 2.0.4.

While running my Rails application I got the following problem, coming from the Devise gem:

IOError in Devise::RegistrationsController#create

The process cannot access the file because another process has locked a portion of the file

While debugging the application with RubyMine IDE, I found that the issue is occurring in acts_as_indexed/lib/acts_as_indexed/storage.rb, line 174, method lock_file. Strangely enough, in the debugger I found that the class variable @@is_windows was having the nil value, which is treated as false from a boolean perspective.

By applying a runtime replacement of the value to "true" in the debugger, my application worked fine. So I guess that this is a bug.

Kindest Regards, Krum.

https://www.savethekoala.com/

dougal commented 12 years ago

Hi Krum.

Yep, bug. The OS detection naively uses the Platform, so will be fooled by JRuby.

I'll either fix this in the next release, or provide a way to configure the storage without locks.

Thanks.

kpymkata commented 12 years ago

Thanks!

Indeed, I could not hit the problem on Linux.

https://www.savethekoala.com/

dougal commented 12 years ago

Hi Krum.

There is now a configuration option for this. See the above commit. Development branch only at the moment.

Thanks.