[crac] RFR: Provide arguments for restore [v5]

Ashutosh Mehra duke at openjdk.java.net
Fri Mar 18 14:51:00 UTC 2022


On Thu, 17 Mar 2022 19:20:50 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> This change adds an ability to receive a new set of command-line arguments in the restored Java instance. The supplied demo code shows a faster replacement for `javac`.
>
> Anton Kozlov has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Use System class loader
>  - Make catch() preceise

I feel it is a useful feature be able to pass new arguments to the restored process. But looking from the user perspective, I see few concerns in the current approach to implement it:
- the current implementation is forcing user to create two classes with the main() method
- consequently the command line to run the application also differs depending on whether the user is running for the first time to take checkpoint, or restoring from the checkpoint
- the stack trace of the main thread after restore has remnant frames from the "before checkpoint" state, which at the least would be confusing to the user

When I was thinking of ways to work around these concerns, I ended up with a solution very similar to the initial approach where an additional API to get the new env variables was added without the requirement to introduce a new class with main method. I feel that would have been a better approach.

I guess the concern with that approach is that the first argument is to be ignored as mentioned [here](https://github.com/openjdk/crac/pull/16#issuecomment-1059730025). I think that shouldn't matter from the user perspective. A user would prefer to use same class name every time to start the application and therefore the JVM can safely ignore the first argument. If the user specifies a different class name during restore, then the JVM should interpret it as a different application and the current checkpoint should not be used for restoring it. In this case the JVM would bail out with an exception.
Does that make sense?

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

PR: https://git.openjdk.java.net/crac/pull/16


More information about the crac-dev mailing list