boson
boson copied to clipboard
boson on jruby file lock exception
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:in
read'
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:in
read'
/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:in
update'
/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:in
each'
/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:in
init'
/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|
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.
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.