JDK-7009975 : Large file support broken in hs20-b04
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-01-03
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u25Fixed 7Fixed hs20Fixed
Related Reports
Relates :  
Description
It looks like the removal of the HPI in 6348631 has broken the large file support on Solaris in jdk7-b123. With hs20-b04 it is no longer possible to use java.io.FileInputStream, FileOutputStream or RandomAccessFile to open files >2GB. Other operations that cause the file to grow to larger than 2GB are also impacted.

I've only briefly looked at the issue but it seems to be that os::open is using ::open rather than ::open64.

Here are some of the regression tests that are failing:

jdk/test/java/io/FileInputStream/LargeFileAvailable.java
java.io.FileNotFoundException: /var/tmp/largefile1592599311387224322.tmp (Value too large for defined data type)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:137)
        at LargeFileAvailable.main(LargeFileAvailable.java:40)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:613)
        at com.sun.javatest.regtest.MainAction$SameVMThread.run(MainAction.java:575)
        at java.lang.Thread.run(Thread.java:732)

jdk/test/java/io/File/SetLastModified.java
java.io.IOException: File too large
        at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
        at sun.nio.ch.FileDispatcherImpl.write(FileDispatcherImpl.java:59)
        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:90)
        at sun.nio.ch.IOUtil.write(IOUtil.java:61)
        at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:193)
        at SetLastModified.main(SetLastModified.java:109)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:613)
        at com.sun.javatest.regtest.MainAction$SameVMThread.run(MainAction.java:575)
        at java.lang.Thread.run(Thread.java:732)

test/java/nio/channels/FileChannel/Size.java fails with:
Exception in thread "main" java.io.IOException: File too large
        at sun.nio.ch.FileDispatcherImpl.truncate0(Native Method)
        at sun.nio.ch.FileDispatcherImpl.truncate(FileDispatcherImpl.java:79)
        at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:814)
        at Size.test2(Size.java:79)
        at Size.main(Size.java:48)

test/java/nio/channels/FileChannel/Transfer.java fails with:
java.io.FileNotFoundException: /var/tmp/blah6957361226591087591.tmp (Value too large for defined data type)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:137)
        at Transfer.xferTest04(Transfer.java:247)
        at Transfer.main(Transfer.java:54)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:613)
        at com.sun.javatest.regtest.MainAction$SameVMThread.run(MainAction.java:575)
        at java.lang.Thread.run(Thread.java:732)

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/039eb4201e06
08-01-2011

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/039eb4201e06
07-01-2011

EVALUATION On Solaris we need to use open64 to work with files larger than 2GB.
07-01-2011

SUGGESTED FIX diff -r 36c186bcc085 src/os/solaris/vm/os_solaris.cpp --- a/src/os/solaris/vm/os_solaris.cpp Mon Jan 03 14:09:11 2011 -0500 +++ b/src/os/solaris/vm/os_solaris.cpp Tue Jan 04 09:50:00 2011 +0000 @@ -5197,7 +5197,7 @@ int os::open(const char *path, int oflag int o_delete = (oflag & O_DELETE); oflag = oflag & ~O_DELETE; - fd = ::open(path, oflag, mode); + fd = ::open64(path, oflag, mode); if (fd == -1) return -1; //If the open succeeded, the file might still be a directory
04-01-2011