[crac] RFR: Add debug flag to -XX:CREngine.
Anton Kozlov
akozlov at openjdk.org
Fri Jan 5 17:15:51 UTC 2024
On Sun, 24 Dec 2023 23:45:29 GMT, Kimura Yukihiro <kyukihiro at openjdk.org> wrote:
> Hello everyone,
>
> This is my first PR for the CRAC project. I propose three modifications to the criuengine.
>
> Firstly, I suggest adding a debug flag to the criuengine, as some JDK C/C++ native codes have the debug flag.
> My proposal is to pass the debug flag using "-XX:CREngine=criuengine,debug,true".
>
> Secondly, the criuengine has a useful function, print_command_args_to_stderr(), which prints the criu command line.
> However, it is only called when an error occurs. I believe it would be beneficial if the criu command line is printed when the debug flag is specified.
>
> The criu command line is built from the parameter of -XX:CREngine and environment variables such as CRAC_CRIU_PATH and CRAC_CRIU_OPT.
> It would be helpful to see how it is actually assembled.
>
> For example:
> $ export CRAC_CRIU_PATH=/work/criu-crac-release-1.4/sbin/criu
> $ ./jdk/bin/java -XX:CREngine=/work/jdk/lib/criuengine,-v,3,-o,output3.log,-d,true -XX:CRaCCheckpointTo=cr Test
>
> Command: /work/criu-crac-release-1.4/sbin/criu dump -t 3232214 -D cr --shell-job '--verbosity=3' -o output3.log
>
> Thirdly, I propose that the criuengine command line, which is executed by the JavaVM, be printed when "-XX:CREngine=criuengine,debug,true" is specified.
> For example,
> CRaC info executing: /work/jdk/lib/criuengine checkpoint -v 3 -o output3.log -d true cr
>
> Testing:
> I have verified the jdk/crac/VMOptionsTest.java, which is a test for -XX:CREngine. I believe it's unnecessary to add a test for the debug flag to it.
>
> Could you please review these modifications?
>
> Thank you,
> Kimura Yukihiro
Printing out implicitly set command line parameters (e.g. via CRAC_CRIU_OPTS) may be indeed useful. Passing down unified logging settings is an interesting idea, although it won't be able to supply arbitrary options. But agree, two different ways to provide options to the engine is too much. CRAC_CRIU_OPTS from one hand is criuengine specific, but it allows easy concatenation with previously set options
CRAC_CRIU_OPTS="$CRAC_CRIU_OPTIONS"
Implementing the same with VM options is possible, but will take some effort. Have we considered introducing `CREngineArg` of `ccstrlist` type (accumulated by existing VM parsing implementation)? So for example `-XX:CREngineArg=debug` would a) accumulate with previously set arguments; b) will cover not only criuengine.
BTW, CREngine is not strictly `diagnostic` ("options are not meant for VM tuning or for product modes."). The wast majority of VM options are "expert" ones.
-------------
PR Comment: https://git.openjdk.org/crac/pull/151#issuecomment-1879002234
More information about the crac-dev
mailing list