Errno::EACCES when multiple files are open simultaneously
---------------------------------------------------------
Key: JRUBY-6022
URL: https://jira.codehaus.org/browse/JRUBY-6022
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.6.4
Environment: Linux cervelo 2.6.32-21-server #32-Ubuntu SMP Fri Apr 16
09:17:34 UTC 2010 x86_64 GNU/Linux
Reporter: Jonathan Beyer
Assignee: Thomas E Enebo
In the process of opening dozens of files, I receive an Errno::EACCES error at
different random locations for each program run. My user does have the proper
file permissions and the code runs fine in cruby.
I realized that I had forgotten to close the file, and closing the file after
use fixes the error. But should jruby produce this error even if I have dozens
of files open? cruby seems to handle it properly.
Here is the offending code and error:
301 def lines( file )
302 if File.exists?( file )
303 f = File.open( file )
304
305 lines = 0
306
307 if f
308 loop do
309 data = ( f.read( 4096 ) or break ) << ( f.gets || '' )
310 lines += data.count( "\n" )
311 (( data.strip! || data ).tr!( "\n", ' ' ) || data ).squeeze!
312 end
313 end
314
315 lines
316 else
317 0
318 end
319 end
AErrno::EACCES: Permission denied -
/cervelo/HistData/MSW/07-10-25_MIDPOINT_ohlc.csv
initialize at org/jruby/RubyFile.java:442
open at org/jruby/RubyIO.java:1107
lines at check_data.rb:303
__file__ at check_data.rb:358
each at org/jruby/RubyArray.java:1603
__file__ at check_data.rb:357
each at org/jruby/RubyArray.java:1603
(root) at check_data.rb:351
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email