Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boson on jruby file lock exception #42

Open
makrisoft opened this issue Jun 8, 2012 · 2 comments
Open

boson on jruby file lock exception #42

makrisoft opened this issue Jun 8, 2012 · 2 comments

Comments

@makrisoft
Copy link

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|

@cldwalker
Copy link
Owner

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.

@duinness
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants