United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7009975 Large file support broken in hs20-b04
JDK-7009975 : Large file support broken in hs20-b04

Details
Type:
Bug
Submit Date:
2011-01-03
Status:
Closed
Updated Date:
2011-03-07
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
hotspot
OS:
generic
Sub-Component:
runtime
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs20 (b06)

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

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
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
                                     
2011-01-04
EVALUATION

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

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

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



Hardware and Software, Engineered to Work Together