Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Checkpoint with open file descriptors by non-JDK APIs #17

Open
LarsGjesse-Zoetis opened this issue Nov 7, 2023 · 0 comments

Comments

@LarsGjesse-Zoetis
Copy link

The motivation for this request is a use case where an agent is attached to the JVM.
When an agent is attached, the JVM holds an open file descriptor to the agent JAR. This causes an exception when creating a checkpoint:

...

2023-11-07T12:38:55.452+01:00 WARN 115571 --- [ main] jdk.crac : File agent.jar was not closed by the application.
2023-11-07T12:38:55.527+01:00 WARN 115571 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to take CRaC checkpoint on refresh
2023-11-07T12:38:55.636+01:00 ERROR 115571 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.context.ApplicationContextException: Failed to take CRaC checkpoint on refresh
at org.springframework.context.support.DefaultLifecycleProcessor$CracDelegate.checkpointRestore(DefaultLifecycleProcessor.java:521) ~[spring-context-6.1.0-SNAPSHOT.jar!/:6.1.0-SNAPSHOT]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:183) ~[spring-context-6.1.0-SNAPSHOT.jar!/:6.1.0-SNAPSHOT]

...

Caused by: org.crac.CheckpointException: null
at org.crac.Core$Compat.checkpointRestore(Core.java:144) ~[crac-1.4.0.jar!/:na]
at org.crac.Core.checkpointRestore(Core.java:237) ~[crac-1.4.0.jar!/:na]
at org.springframework.context.support.DefaultLifecycleProcessor$CracDelegate.checkpointRestore(DefaultLifecycleProcessor.java:515) ~[spring-context-6.1.0-SNAPSHOT.jar!/:6.1.0-SNAPSHOT]
... 17 common frames omitted
Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenFileException: FD fd=15 type=regular path=agent.jar
at java.base/jdk.internal.crac.mirror.Core.translateJVMExceptions(Core.java:114) ~[na:na]
...
... 19 common frames omitted

The file descriptor policies feature doesn't help here, because the file does not appear to be opened through a JDK API.
I investigated if the agent JAR could be loaded from a memory file system, like https://github.com/marschall/memoryfilesystem. But as far as I can see, an agent JAR can only be specified via a path to the default filesystem.
The underlying CRIU library does allow a checkpoint to be created with open FDs for several types of descriptors, including normal files.

Would it be possible to extend file descriptor policies to FDs not opened through a JDK API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant