JDK-8209462 : (timer) Repeated task stops working when the time is moved backward
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 8,11
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2018-08-09
  • Updated: 2018-08-22
  • Resolved: 2018-08-22
Related Reports
Duplicate :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
/ macOS High Sierra v.10.13.5 / Java v.1.8.0_162-b12

A DESCRIPTION OF THE PROBLEM :
- If I modify the time of my computer and I set a minor time compared to the current time, the task stop working.
- If I modify the time of my computer and I set a major time compared to the current time, the task continue working as well.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Copy and paste the provided code and execute it
2. Now change the time of your computer with a minor time (for example from 18:19:26 to 15:19:26)

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The software should continue printing numbers. This is a real problem when the daylight savings time arrives (summer/winter).
ACTUAL -
The program stops printing numbers

---------- BEGIN SOURCE ----------
Timer timer = new Timer();
TimerTask timertask = new TimerTask() {
    @Override
    public void run() {
        System.out.println(ThreadLocalRandom.current().nextInt(0, 1000));
    }
};
timer.schedule(timertask, 0, 1000);
---------- END SOURCE ----------

FREQUENCY : always



Comments
Dup of JDK-4290274
22-08-2018

See JDK-4290274 for more discussion
21-08-2018

To reproduce , run the attached test case. Move the system time backward by an hour, the program hangs. When after running the test case, the system time is moved forward, the program keeps running. JDK 8u181 - Fail JDK 10.0.2 - Fail JDK 11-ea+24 - Fail
14-08-2018