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

Radim Vansa duke at openjdk.org
Mon May 15 06:02:15 UTC 2023


On Fri, 12 May 2023 14:56:11 GMT, Jan Kratochvil <duke at openjdk.org> wrote:

>> I agree with your line of thinking, and since this test actually uses custom docker image I can add those libraries to the base image. But in general it's a problem of criu packaging with implicit dependencies, officially installed binary should get this handled in dependency management. Since those few functions from libbsd are reimplemented in criu, we could just disable the dependency in our fork.
>> However we'll run into the same problem with libnftables - I found that with the nftables support the unprivileged restore as root in Docker container does not work anymore. And that got compiled in only because of the -dev library present, there's no compile time switch.
>> 
>> The error you describe can be solved with `git clean -f -x`, regrettably `make clean` does not do its job very well.
>> 
>> Not sure what function are you suggesting to replace?
>
> 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?

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

PR Review Comment: https://git.openjdk.org/crac/pull/53#discussion_r1193356916


More information about the crac-dev mailing list