boson icon indicating copy to clipboard operation
boson copied to clipboard

boson on jruby file lock exception

Open makrisoft opened this issue 12 years ago • 2 comments

Error: Bad file descriptor - cannot acquire exclusive lock on File not opened for write Original error: Bad file descriptor - cannot acquire exclusive lock on File not opened for write org/jruby/RubyFile.java:343:in flock' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-more-0.2.2/lib/boson/repo_index.rb:39:inread' org/jruby/RubyIO.java:1139:in open' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-more-0.2.2/lib/boson/repo_index.rb:37:inread' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-more-0.2.2/lib/boson/repo_index.rb:122:in changed_libraries' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-more-0.2.2/lib/boson/repo_index.rb:17:inupdate' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-more-0.2.2/lib/boson/index.rb:13:in update' org/jruby/RubyArray.java:1615:ineach' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-more-0.2.2/lib/boson/index.rb:13:in update' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-more-0.2.2/lib/boson/runner_options.rb:22:ininit' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-1.2.4/lib/boson/bin_runner.rb:101:in start' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-1.2.4/bin/boson:6:in(root)' org/jruby/RubyKernel.java:1068:in load' /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-1.2.4/bin/boson:19:in' org/jruby/RubyKernel.java:1088:in eval' /home/emakris/.rvm/gems/jruby-1.6.7.2/bin/ruby_noexec_wrapper:14:in(root)' emakris@frodo:/usr/share/postgresql/9.1$ emacs /home/emakris/.rvm/gems/jruby-1.6.7.2/gems/boson-more-0.2.2/lib/boson/repo_index.rb

I changed line 38 to this to fix the issue:

File.open(marshal_file, 'rb+') do |f|

makrisoft avatar Jun 08 '12 17:06 makrisoft

Sorry for the delay. I don't have time to dig into this but I'm willing to take a patch 'rb+' if it's done just for jruby. I don't want to mess up what was done for #30.

cldwalker avatar Jan 24 '13 03:01 cldwalker

I had this same issue with a unit test in my code. It worked fine with MRI 1.9.3.

File.open(".\test\log\testfile3.log",File::CREAT, 0644) do |f| f.flock(File::LOCK_EX)

I changed the above to the below and now it works perfectly in both MRI and Jruby.1.7.2

File.open(".\test\log\testfile3.log",'rb+') do |f| f.flock(File::LOCK_EX)

You've saved me a lot of work and confusion. Thank you.

duinness avatar Jan 30 '13 23:01 duinness