[crac] RFR: 8353243: [CRaC] Show all options in engine help [v2]

Timofei Pushkin tpushkin at openjdk.org
Mon Apr 7 13:06:27 UTC 2025


On Mon, 7 Apr 2025 12:33:32 GMT, Timofei Pushkin <tpushkin at openjdk.org> wrote:

>>> Yes, but just library_path is not enough, engine executable does not always come from there sines the user can provide an arbitrary absolute path. In the first version of the API crexec ended up using args instead of library_path for this.
>> ...
>>> would be better to rename it to `engine_location`
>> 
>> In the current impl it is telling the `lib` path within JDK installation location, rather than location of the engine (shared library). Anyway this doesn't have to be exhaustive: there might be other option (JVM wouldn't know about) to hint about some other path.
>> 
>>> I've never tried to get a file address of a shared library from within itself but after some googling it doesn't seem too complicated (for a not so commonly needed thing).
>> 
>> Looking into this again I see that it is actually quite simple using `dladdr`. I am not sure why I have resorted to reading `/proc/self/maps` in some of my code... However, if the engine is set using absolute path outside JVM it might be problematic to get the JVM path (`JAVA_HOME` not being set...).
>> 
>>> We could pass exec_location to all engines that accept it ... but I am not sure how useful this would be to other engines
>> 
>> I might have focused too much on this being "handy", but my main objective was to not have any code in JVM that would treat different engines differently.
>> 
>> Btw. there's third option: we could use the `dladdr/GetModuleFileName` in `crexec` and drop `exec_location` completely.
>
>> I might have focused too much on this being "handy", but my main objective was to not have any code in JVM that would treat different engines differently.
> 
> Well, JVM will treat `crexec` somewhat specially anyway because this is the only engine that is not requested by the user directly but rather by the JVM (when it finds that the user requested an executable engine), but I get it that you want to reduce such special handling as much as possible.
> 
>> Btw. there's third option: we could use the dladdr/GetModuleFileName in crexec and drop exec_location completely.
> 
> Through `dladdr`/`GetModuleFileName` crexec can find where it is located, i.e. this is indeed a substitution for `library_path`. But we'll still need to pass the location of the engine executable (otherwise crexec won't know what exactly to call), and it can be any user-provided absolute path, not only `lib` within JDK installation. The most convenient way would be to use an option which leads us to `exec_location` again.

> Anyway this doesn't have to be exhaustive: there might be other option (JVM wouldn't know about) to hint about some other path.

If JVM doesn't know about it then it should be passed by the user directly: `-XX:CRaCEngine=crexec -XX:CRaCEngineOptions=engine=criu` — this would be somewhat inconvenient from UX perspective

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

PR Review Comment: https://git.openjdk.org/crac/pull/220#discussion_r2031197494


More information about the crac-dev mailing list