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

nio NFS file Locking is failing on some Suse Linux systems

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Not an Issue
    • Affects Version/s: 5.0, 5.0u1
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux_suse_sles_8

      Description

      4-5 test case related to java.util.prefs and java.nio.channel
      are failing, seeing the error code, it is related to file locking.

      Tested these tests on Build-59

      Sample Code for java.util.prefs

      import java.util.prefs.*;
      import java.util.*;
       

      public class Test20 {
           
          public void check1() {
               try {
                 Preferences userRoot = Preferences.userRoot();
                 userRoot.put("Test","Libs");
                 userRoot.flush();
                 System.out.println("The vale got back is :"+userRoot.get("Test","Default"));
                } catch(Exception e) {
                  e.printStackTrace();
                }
             
          }
          
       
          
          public static void main(String[] args) throws Exception {
            Test20 ref = new Test20();
            ref.check1();
            
           }
       

      }


      Sample code for File Locking
      Before Running this test create any file by name Sample.txt

      import java.io.*;
      import java.nio.channels.*;
      import java.nio.*;

      public class Test21 {

         public boolean check() throws Exception {
              boolean bReturn = true;
              RandomAccessFile raf = null;
              FileChannel c = null;
              File tempFile = new File("Sample.txt");
              tempFile.deleteOnExit();
              try {
                 raf = new RandomAccessFile(tempFile,"rw");
                 c = raf.getChannel();
                 FileLock fl1 = c.lock(0,c.size(),true);
      FileChannel fc = fl1.channel();
      if(!fc.equals(c)) {
        bReturn = false;
                      System.out.println("channelTest01: FAIL.");
                 }
      fl1.release();
      c.close();
              } catch (Exception e) {
                 bReturn = false;
                 e.printStackTrace();
              }

              return bReturn;
             
         }
         
          
         
         public static void main(String args[]) {
             Test21 ref = new Test21();
             try {
               System.out.println("Test For File Channel Passed "+ref.check());
             } catch(Exception e) {
                e.printStackTrace();
             }
         }
      }


      ----------------------------------------------
      I executed both the test cases on AMD64 with RH AS-3
      Red Hat Enterprise Linux AS release 3 (Taroon)
      Kernel 2.4.21-4.EL on an x86_64

      Both the test cases passed,
      On Intel arch with RH AS-3 it works fine.

      I am seeing the failure on ALSES-8

      In addition to above information:-
      Test case Test21 passes on AMD64 SLES-8
      if we copy the test case to local directory
      over the NFS it fails.

      Whereas the test case Test20 fails even if copied
      and executed from local directory.
      SQE:-
      Jitender Singh.

      -----------------------------------------------------------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                martin Martin Buchholz
                Reporter:
                jsinghsunw Jit Singh (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: