[crac] RFR: Correct System.nanotime() value after restore [v2]

Anton Kozlov akozlov at openjdk.org
Thu Mar 30 11:09:56 UTC 2023


On Thu, 30 Mar 2023 07:55:35 GMT, Radim Vansa <duke at openjdk.org> wrote:

>> There are various places both inside JDK and in libraries that rely on monotonicity of `System.nanotime()`. When the process is restored on a different machine the value will likely differ as the implementation provides time since machine boot. This PR records wall clock time before checkpoint and after restore and tries to adjust the value provided by nanotime() to reasonably correct value.
>
> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Correct time since restore

Crac-criu does not use restore timens [1]  since once a bug in kernel or criu caused timedwait to return immediatelly everytime that is called after restore. I don't remember the bug exactly (already fixed), but I believe it was discussed on this maillist.

In general, we should not to depend on very obscure linux abillities, as this reduce chances we'd be able to run on something rather than linux. Having the code in the JVM provides better control for the implementation the java spec.

[1] https://github.com/CRaC/criu/commit/1cb2f4a518a4ae471a1df7a9b540203c1efaf1ba

-------------

PR Comment: https://git.openjdk.org/crac/pull/53#issuecomment-1490112327


More information about the crac-dev mailing list