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

Jan Kratochvil duke at openjdk.org
Thu May 11 14:32:16 UTC 2023


On Thu, 27 Apr 2023 11:55:53 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:
> 
>   Use image under ghcr.io/crac

On Fedora 36 x86_64 when I snapshot the image, reboot and restore it with boottime earlier than it was during the snapshot I get a hanging restore:

#0  0x00007f43778899b9 in __futex_abstimed_wait_common () from /lib64/libc.so.6
#1  0x00007f437788e983 in __pthread_clockjoin_ex () from /lib64/libc.so.6
#2  0x00007f4377abe655 in CallJavaMainInNewThread (stack_size=1048576, args=0x7ffdd525b5d0) at ../src/java.base/unix/native/libjli/java_md.c:681
#3  0x00007f4377abb7fd in ContinueInNewThread (ifn=0x7ffdd525b6d0, ifn at entry=0x0, threadStackSize=<optimized out>, argc=<optimized out>, argv=0x5641c59c75f8, mode=mode at entry=1, what=0x5641c59c7380 "NanoTime", what at entry=0x0, ret=0) at ../src/java.base/share/native/libjli/java.c:2362
#4  0x00007f4377abe709 in JVMInit (ifn=0x0, ifn at entry=0x7ffdd525b6d0, threadStackSize=<optimized out>, argc=<optimized out>, argv=<optimized out>, mode=mode at entry=1, what=0x0, what at entry=0x5641c59c7380 "NanoTime", ret=<optimized out>) at ../src/java.base/unix/native/libjli/java_md.c:706
#5  0x00007f4377abc4e0 in JLI_Launch (argc=<optimized out>, argc at entry=3, argv=<optimized out>, argv at entry=0x5641c59c72c0, jargc=jargc at entry=0, jargv=jargv at entry=0x5641c3cfa008 <const_jargs>, appclassc=appclassc at entry=0, appclassv=appclassv at entry=0x0, fullversion=0x5641c3cf8088 "17-internal+0-adhoc.azul.crac-git", dotversion=0x5641c3cf8079 "0.0", pname=0x5641c3cf8074 "java", lname=0x5641c3cf806c "openjdk", javaargs=0 '\000', cpwildcard=1 '\001', javaw=0 '\000', ergo=0) at ../src/java.base/share/native/libjli/java.c:342
#6  0x00005641c3cf730a in main (argc=<optimized out>, argv=<optimized out>) at ../src/java.base/share/native/launcher/main.c:282

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

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


More information about the crac-dev mailing list