JDK-8246261 : TCKLocalTime.java failed due to "AssertionError: expected [18:14:22] but found [18:14:23]"
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: other
  • CPU: x86_64
  • Submitted: 2020-06-01
  • Updated: 2021-08-10
  • Resolved: 2020-06-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11.0.13-oracleFixed
Related Reports
Relates :  
Description
The following test failed in the JDK15 CI:

java/time/tck/java/time/TCKLocalTime.java

Here's a snippet from the failing log file:

config tck.java.time.TCKLocalTime.setUp(): success
test tck.java.time.TCKLocalTime.now_Clock_nullClock(): success
config tck.java.time.TCKLocalTime.setUp(): success
test tck.java.time.TCKLocalTime.now_ZoneId(): failure
java.lang.AssertionError: expected [18:14:22] but found [18:14:23]
	at org.testng.Assert.fail(Assert.java:94)
	at org.testng.Assert.failNotEquals(Assert.java:496)
	at org.testng.Assert.assertEquals(Assert.java:125)
	at org.testng.Assert.assertEquals(Assert.java:167)
	at tck.java.time.TCKLocalTime.now_ZoneId(TCKLocalTime.java:251)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at org.testng.TestRunner.privateRun(TestRunner.java:773)
	at org.testng.TestRunner.run(TestRunner.java:623)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
	at org.testng.SuiteRunner.run(SuiteRunner.java:259)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
	at org.testng.TestNG.run(TestNG.java:1018)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
	at jdk.internal.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:832)
config tck.java.time.TCKLocalTime.setUp(): success
test tck.java.time.TCKLocalTime.now_ZoneId_nullZoneId(): success
config tck.java.time.TCKLocalTime.setUp(): success
test tck.java.time.TCKLocalTime.test_adjustInto(23:05, 04:01:01.000000100, 23:05, null): success

<snip>

config tck.java.time.TCKLocalTime.setUp(): success
test tck.java.time.TCKLocalTime.test_with_longTemporalField_secondOfMinute(): success

===============================================
java/time/tck/java/time/TCKLocalTime.java
Total tests run: 3057, Failures: 1, Skips: 0
===============================================

----------System.err:(11/604)----------
java.lang.Exception: failures: 1
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:96)
	at jdk.internal.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:832)

JavaTest Message: Test threw exception: java.lang.Exception
JavaTest Message: shutting down test

result: Failed. Execution failed: `main' threw exception: java.lang.Exception: failures: 1


test result: Failed. Execution failed: `main' threw exception: java.lang.Exception: failures: 1

Since this is a Tier2 failure, I'm starting this bug off as a P3
for initial triage.
Comments
Fix Request (11u) Clean backport to match 11.0.13-oracle. Affected test still runs.
10-08-2021

URL: https://hg.openjdk.java.net/jdk/jdk/rev/56ad9198a04b User: naoto Date: 2020-06-02 20:50:14 +0000
02-06-2020

This could have been triggered by the change in the precision enabled under JDK-8242504: Enhance the system clock to nanosecond precision
02-06-2020

The test case compares two LocalTime objects, created with LocalTime.now(Clock/ZoneId). So inherently those two objects could have different times. The test then try comparing them 100 times for the exact match, and if not, then falls back to compare those times by truncating nanoseconds. The failure could occur when those two are around the whole second, e.g., expected == 18:14:22.999999 and test == 18:14:23.000001.
01-06-2020