JDK-8165659 : ntpd service is restarting java timer scheduled processes
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 8u77
  • Priority: P4
  • Status: Closed
  • Resolution: Incomplete
  • OS: other
  • CPU: x86
  • Submitted: 2016-08-03
  • Updated: 2016-10-07
  • Resolved: 2016-08-04
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux 3.10.0-327.22.2.el7.x86_64

A DESCRIPTION OF THE PROBLEM :
When ntpd service runs and clock drifts then java timer scheduled processes are getting restarted.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create timer scheduled java process.
2. execute the process.
3. restart ntpd service.
4. observation will be process restart at the same time ntpd service is restarted and clock       drifts to new time.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expectation is not to see process restart but jvm should take new clock time into consideration for next schedule of timer.
ACTUAL -
Processes are getting killed and resource are hung which are recovered later by garbage collection and processes are restarted.

REPRODUCIBILITY :
This bug can be reproduced always.


Comments
The behaviour of OpenJDK and oracle JDK will be the same. The java.util.Timer class provides methods that handle absolute times (which should track changes to the system clock) and relative times (which should not). However, the implementation of Timer is such that all scheduled activities are converted to relative times, which should generally not be affected by any subsequent change to the system time via ntpd. That said, the low-level implementation can sometimes be affected by changes to system time if the underlying OS facilities used are themselves affected. See related discussion in JDK-4290274. As noted there java.util.Timer behaviour will not be changed. Consider using ScheduledExecutor and see if that behaves as expected.
07-10-2016

Didn't get the confirmation whether the case is reproducible on Oracle JDK. Hence closing it as incomplete for now. Will reopen once get additional information on it.
08-09-2016

E-mail to submitter: -------------------------- The incident has been reported for OpenJDK. Can you please let us know if you observe the same behavior in Oracle JDK as well. Here is the download path for the latest GA version and JDK 9 early access versions : https://jdk9.java.net/download/ http://www.oracle.com/technetwork/java/javase/downloads/index.html Also, please provide a test case to reproduce the issue.
04-08-2016