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

ThreadedSeedGenerator uses System.currentTimeMillis and stops generating when time is set back

XMLWordPrintable

    • b125
    • generic
    • generic
    • Not verified

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.10586]

      A DESCRIPTION OF THE PROBLEM :
      The ThreadedSeedGenerator class contains the following code:

      // We wait 250milli quanta, so the minimum wait time
      // cannot be under 250milli.
      int latch = 0;
      long l = System.currentTimeMillis() + 250;
      while (System.currentTimeMillis() < l) {
          synchronized(this){};
          latch++;
      }

      Since it uses System.currentTimeMillis for the wait, which reflects the actual system time, moving back the system time will cause this code to wait a lot longer.

      In my case, calling createTempFile hangs for 2 hours after changing back the system time for 2 hours... Perhaps use System.nanoTime for this wait?


      REPRODUCIBILITY :
      This bug can be reproduced occasionally.

            weijun Weijun Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: