java.io.RandomAccessFile Invalid Argument for large files on mac
Asked Answered
T

1

6

I'm running a program which needs random access to a very large file (approximately 151 gigabytes). I've found that whenever it runs on one of the MacPro machines in the Orchard lab ( details at http://inst.eecs.berkeley.edu/cgi-bin/clients.cgi?choice=6a&string= ), the program tries to read a specific part of the file and crashes with an error from the file system:

java.io.IOException: Invalid argument
    at java.io.RandomAccessFile.readBytes(Native Method)
    at java.io.RandomAccessFile.read(RandomAccessFile.java:322)

I'm just using the RandomAccessFile class.

RandomAccessFile fd;
//...Initialized and already used fd with
//no problems for larger locations as well
//location == 155587178230
//numBytes == 15492560
//off == 0
//arr.length == 15492560
fd.seek(location);
fd.read(arr, off, numBytes);

It happens in the same exact place for the same exact range of bytes every time no matter which of the Orchard lab computers I use.

I've tested this code on DELL computers running Debian Linux and not had this problem.

Timbal answered 5/12, 2010 at 20:2 Comment(4)
What do you want? Explaination or solution? Seems like it could be related to this: bugs.sun.com/bugdatabase/view_bug.do?bug_id=4481658Varick
@Varick 2001, Windows 95 vs 2010, Mac... Is similar though.Gallstone
That's not what's going on. That bug happens on all calls above a certain limit. Here, I've already called the method for larger values of location with no problem, but it always happens at this specific range. Explanation or solution would be fine. Is this an issue with the file system or with java or something else?Timbal
It might be an idea to post a link to this on the Apple java mailing. The Apple dev team do read at that list and may be able to helpKokanee
E
1

You should use the linux command "dd" to check if the file is really readable at the given location. I assume the file is on a network drive in the MAC lab, and if you access your copy of the file on the Dell linux workstation you won't get this error because DELLs disks are not broken.

Ensoll answered 10/1, 2011 at 18:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.