[crac] RFR: Correct System.nanotime() value after restore
    Radim Vansa 
    duke at openjdk.org
       
    Wed Mar 29 14:58:26 UTC 2023
    
    
  
On Thu, 23 Mar 2023 15:38: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.
Thanks for those pointers. I've checked that the NanoTimeTest fails without the 'fix' in place; The dump creates `timens-0.img` (35 bytes) but it looks like this is not used later on; when I run restore with `-v4` I see these log messages:
(00.003124) Reading image tree
(00.003138) Add mnt ns 6 pid 8
(00.003139) Add net ns 2 pid 8
(00.003140) Add pid ns 1 pid 8
(00.003141) pstree pid_max=8
(00.003143) Will restore in 0 namespaces
(00.003144) NS mask to use 0
and I can't find log entry that would report this:
pr_debug("timens: monotonic %ld %ld\n", ts.tv_sec, ts.tv_nsec);
Any clues why this is not applied?
-------------
PR Comment: https://git.openjdk.org/crac/pull/53#issuecomment-1488786017
    
    
More information about the crac-dev
mailing list