[crac] RFR: 8351402: [CRaC] Use System.nanoTime() in TimedWaitingTest [v2]
Timofei Pushkin
tpushkin at openjdk.org
Tue Mar 11 11:38:14 UTC 2025
On Fri, 7 Mar 2025 14:41:01 GMT, Timofei Pushkin <tpushkin at openjdk.org> wrote:
>> Replaces `System.currentTimeMillis()` with `System.nanoTime()` in `TimedWaitingTest` since the former can, in theory, jump back and forth and that may lead to the test failures.
>>
>> Also adds a diagnostic assert.
>
> Timofei Pushkin has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix time check
There have been private discussions about the test. Whether it should test:
- the specification compliance: that timed waiting is not shorter than it should be according to the spec — in this case using nanoTime should probably be the fix, or
- the implementation: that CRaC doesn't manipulate nanoTime in a way that makes timed waiting shorter than it would be without CRaC (this should be a superset of the first point) — in this case we should use some other way to access monotonic time but not nanoTime.
I think we've leaned towards the second, so it should be checked that the non-monotonicity of systemTimeMillis is really the reason of the test failures. So I'll make this a draft for now.
-------------
PR Comment: https://git.openjdk.org/crac/pull/209#issuecomment-2713809726
More information about the crac-dev
mailing list