[crac] RFR: Correct System.nanotime() value after restore [v6]
Jan Kratochvil
duke at openjdk.org
Tue May 16 12:29:16 UTC 2023
On Mon, 15 May 2023 05:59:11 GMT, Radim Vansa <duke at openjdk.org> wrote:
>> I mean to provide normal LD_PRELOAD library and then one no longer needs to deal with any containers with their associated problems discussed above.
>> [libvirtual.c.txt](https://github.com/openjdk/crac/files/11465377/libvirtual.c.txt)
>> [clock_gettime.cpp.txt](https://github.com/openjdk/crac/files/11465400/clock_gettime.cpp.txt)
>>
>> rm -rf dir;mkdir dir;LD_PRELOAD=$PWD/libvirtual.so CLOCK_MONOTONIC=10 BOOT_ID=$PWD/fake_boot_id ./clock_gettime &p=$!;sleep 2;sudo ./build/linux-x86_64-server-fastdebug/jdk/lib/criu dump --shell-job -t $p -D dir
>> CLOCK_MONOTONIC=88547. 87286504 CLOCK_BOOTTIME=88547. 87304536
>> CLOCK_MONOTONIC=88548. 87433771 CLOCK_BOOTTIME=88548. 87445951
>> CLOCK_MONOTONIC=88549. 87564393 CLOCK_BOOTTIME=88549. 87573859
>> Warn (criu/pages-compress.c:216): decompress: Can't open 'pages-1.comp.img' for dfd=3, errno=2 [--- that is some bug]
>> CLOCK_MONOTONIC=10. 82447 CLOCK_BOOTTIME=88556.959892251
>> CLOCK_MONOTONIC=11. 179010 CLOCK_BOOTTIME=88557.959969582
>> CLOCK_MONOTONIC=12. 264924 CLOCK_BOOTTIME=88558.960056407
>>
>> With original JVM it correctly crashes:
>>
>> # Internal Error (../../src/hotspot/share/runtime/thread.cpp:2470), pid=74780, tid=74781
>> # assert(false) failed: unexpected time moving backwards detected in JavaThread::sleep()
>>
>> With your patch it runs although somehow slowly.
>> It may need some adjustments, I wrote the library as a proof of concept to prevent the containers.
>> One cannot use the library to test native CRIU timens as that happens at kernel-level.
>
> How would you compile that library as part of of the jtreg? Just do `Runtime.getRuntime().exec("gcc", ...)` during the test? Can you create some native libraries as a part of the test library build?
I do not know much jtreg. One can try `Runtime.getRuntime().exec("gcc", ...)` and Java experts can improve it later.
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/53#discussion_r1195086680
More information about the crac-dev
mailing list