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

Thread.sleep() does not work as expected in Solaris.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P1 P1
    • None
    • 1.2.2, 1.4.2
    • hotspot
    • None
    • x86, sparc
    • linux, solaris_8


      The sleep function does not accuratly block for the specified
      milliseconds.

      please try the program listed below :

      *********** timeTest.java ****************

      class timeTest
      {

              public static void main(String[] args)
              {

                      long start = System.currentTimeMillis();

                      for(int i = 0;i < 1000;i++) {

                              try {
                              Thread.sleep(1);
                              } catch( InterruptedException ex) {}
                      }

                      long stop = System.currentTimeMillis();

                      System.out.println(" Time taken : " + (stop - start));
              }
      }

      **********************************************

      on running this program in Solaris 8 & Solaris 7 with jdk1.2.2

      the program prints a result of 19992 milliseconds.

      on windows NT, I get the correct expected result of 1002 milliseconds.

      I get varying results with other JDK's ( with 1.3 it took 10003 ms)
      in Solaris.

      clearly the sleep function is broken for the solaris environment
      as it does not block accuratly for the specified time.

      balaji.raghunathan@eng 2000-09-21

      Thread.sleep() for nano seconds time interval does not work too.

      Thread.sleep() simply does not timeout properly for any given
      time interval. This could be a very serious problem in all Java
      based server software for the Solaris platform. note: it works ok in
      Windows NT and that makes this bug even more important to fix.




            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: