Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6401919

java.nio.channels.FileChannel.tryLock method call fails with an I/O exception

XMLWordPrintable

    • sparc
    • solaris_9

      > * Severity: Significant impact on primary functionality
      > * Short description: Sometimes the java.nio.channels.FileChannel.tryLock method call fails with an I/O exception with the error message ?Invalid argument?
      > * Primary design contact: Norbert Ghersin, ###@###.###, 613-763-8788
      > * Full problem description:
      >
      > I have run into a JDK bug with identical symptoms as bug 6230772 (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6230772). The latter was reported against JDK 1.4.2_07 on Linux.
      >
      > When running the following code (see test-case) against some files it fails with an I/O exception with error message ?Invalid argument?. Since the bug description for 6230772 includes the output of running the ?truss? command, I have the truss output file (truss_output).

      > The command I ran was: ?truss java F?
      >
      > I am not sure about why this file (or any file within the same directory fails), but it may be because it is on a different disk partition. I even tried running the test against other folders on the failing partition and it did not work. The files I tried to lock were created, could be delete but locking failed.
      >
      > Here are the results of some runs:
      > ~/temp F /opt/cems/blah
      > java.io.IOException: Invalid argument
      > Unable to acquire lock!
      > /opt/cems> ls -l /opt/cems/blah
      > -rw-rw-r-- 1 nghersin cellone 0 Mar 1 21:30 /opt/cems/blah
      > /opt/cems> df -k .
      > Filesystem kbytes used avail capacity Mounted on
      > /net/zcars0xz/export/vobstore/disk2/cdma_bssm/cems.vbs
      >
                           77750272 63620609 13289426 83% /vobs/cems
      >
      > java -classpath ~/temp F ~/blah
      >
      > Successfully locked file
      >
      > /opt/cems> ls -l ~/blah
      >
      > -rw-rw-r-- 1 nghersin cellone 0 Mar 1 21:35 /home/nghersin/blah
      >
      > /opt/cems> df -k ~
      >
      > Filesystem kbytes used avail capacity Mounted on
      >
      > zcareb60:/export/users/car411/nghersin
      >
      > 79508336 42631024 36877312 54% /home/nghersin

      > We still see the same locking failure problem at our end. This time I repeated the test with 3 java versions that is available in our environment:
      > java version ?1.4.2_06?
      > java version ?1.5.0_02?
      > java version ?1.5.0_04?
      >
      > Interestingly, java version 1.4.2_06 is successful in obtaining locks in both disk partitions, while 1.5.0_02 and 1.5.0_04 failed in one of them (same as originally reported).

      > <vob> [temp]=105=> /vobs/cems/thirdparty/j2se/solaris/bin/javac F.java
      > <vob> [temp]=106=> /vobs/cems/thirdparty/j2se/solaris/bin/java -classpath ~/temp F /opt/cems/blah
      > Successfully locked file
      > <vob> [temp]=107=> /vobs/cems/thirdparty/j2se/solaris/bin/java -classpath ~/temp F ~/blah
      > Successfully locked file
      > <vob> [temp]=108=> /vobs/cems/thirdparty/j2se/solaris/bin/java -version
      > java version "1.4.2_06"
      > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
      > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
      > <vob> [temp]=109=>
      > <vob> [temp]=109=>
      > <vob> [temp]=109=> /vobs/cems/thirdparty/jdk1.5.0_02/solaris/bin/javac F.java
      > <vob> [temp]=110=> /vobs/cems/thirdparty/jdk1.5.0_02/solaris/bin/java -classpath ~/temp F /opt/cems/blah
      > java.io.IOException: Invalid argument
      > Unable to acquire lock!
      > <vob> [temp]=111=> /vobs/cems/thirdparty/jdk1.5.0_02/solaris/bin/java -classpath ~/temp F ~/blah
      > Successfully locked file
      > <vob> [temp]=112=> /vobs/cems/thirdparty/jdk1.5.0_02/solaris/bin/java -version
      > java version "1.5.0_02"
      > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
      > Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode)
      > <vob> [temp]=113=>
      > <vob> [temp]=113=>
      > <vob> [temp]=113=> /vobs/cems/thirdparty/jdk1.5.0_04/solaris/bin/javac F.java
      > <vob> [temp]=114=> /vobs/cems/thirdparty/jdk1.5.0_04/solaris/bin/java -classpath ~/temp F /opt/cems/blah
      > java.io.IOException: Invalid argument
      > Unable to acquire lock!
      > <vob> [temp]=115=> /vobs/cems/thirdparty/jdk1.5.0_04/solaris/bin/java -classpath ~/temp F ~/blah
      > Successfully locked file
      > <vob> [temp]=116=> /vobs/cems/thirdparty/jdk1.5.0_04/solaris/bin/java -version
      > java version "1.5.0_04"
      > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
      > Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)

      And the problem is seen on a different machine as well.

      * Test Case Attached with this CR *

      Step to run the test case :
         Run the Java file along with the Path of the file residing in a different partition in command line argument

            Unassigned Unassigned
            sdattatrsunw Sreenatha Dattatri (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: