[crac] RFR: Correct System.nanotime() value after restore [v6]
Jan Kratochvil
duke at openjdk.org
Thu May 11 14:28:15 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
src/hotspot/share/runtime/os.cpp line 2069:
> 2067: }
> 2068: }
> 2069: }
No newline at end of file
src/java.base/share/classes/java/lang/System.java line 69:
> 67: import java.util.concurrent.ConcurrentHashMap;
> 68: import java.util.stream.Stream;
> 69:
Excessive whitespace change.
src/java.base/share/classes/java/lang/System.java line 2453:
> 2451: });
> 2452: }
> 2453:
Excessive whitespace change.
test/hotspot/jtreg/testlibrary/jittester/conf/exclude.methods.lst line 29:
> 27: java/lang/System::loadLibrary(Ljava/lang/String;)
> 28: java/lang/System::mapLibraryName(Ljava/lang/String;)
> 29: java/lang/System::nanoTime0()
Is this change really needed?
test/jdk/jdk/crac/java/lang/System/NanoTimeTest.java line 82:
> 80: "-e", "LD_PRELOAD=/opt/path-mapping-quiet.so",
> 81: "-e", "PATH_MAPPING=/proc/sys/kernel/random/boot_id:/fake_boot_id",
> 82: CracBuilder.CONTAINER_NAME, CracBuilder.DOCKER_JAVA);
On Fedora 36 x86_64 the testcase does not work for me:
Starting docker container:
docker run --rm -d --privileged --init --volume /home/azul/azul/crac-git/JTwork/classes/jdk/crac/java/lang/System/NanoTimeTest.d:/cp/0 --volume /home/azul/azul/crac-git/JTwork/classes/test/lib:/cp/1 --volume cr:/cr --volume /home/azul/azul/crac-git/build/linux-x86_64-server-fastdebug/jdk/lib/criu:/criu --env CRAC_CRIU_PATH=/criu --name crac-test -v /tmp/NanoTimeTest-3201524983642970594-boot_id:/fake_boot_id jdk-internal:test-system-nanotime sleep 3600
Starting process to be checkpointed:
docker exec -e LD_PRELOAD=/opt/path-mapping-quiet.so -e PATH_MAPPING=/proc/sys/kernel/random/boot_id:/fake_boot_id crac-test /jdk/bin/java -ea -cp /cp/0:/cp/1: -XX:CRaCCheckpointTo=cr jdk.test.lib.crac.CracTest __run_test__ NanoTimeTest 0 true
/criu: error while loading shared libraries: libbsd.so.0: cannot open shared object file: No such file or directory
Exception in thread "main" jdk.crac.CheckpointException
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/53#discussion_r1191248589
PR Review Comment: https://git.openjdk.org/crac/pull/53#discussion_r1191248975
PR Review Comment: https://git.openjdk.org/crac/pull/53#discussion_r1191249120
PR Review Comment: https://git.openjdk.org/crac/pull/53#discussion_r1191249848
PR Review Comment: https://git.openjdk.org/crac/pull/53#discussion_r1191253534
More information about the crac-dev
mailing list