Skip to content

Commit

Permalink
[Runtime] CRaC: fix the bug that cannot restore pipe fd successful.
Browse files Browse the repository at this point in the history
Summary: If the image dir is a relative path, the criuenginue process cannot write to the pipefds file in image dir.So convert it to real path before do checkpointing.

Testing: jdk/jdk/crac/AppendAppClassLoaderTest.java,jdk/jdk/crac/RestorePipeFdTest.java

Reviewers: yansendao.ysd,lvfei.lv

Issue: #867
  • Loading branch information
lingjun-cg committed Oct 10, 2024
1 parent fdb2453 commit d6712d3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/java.base/unix/native/criuengine/criuengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,12 @@ static int checkpoint(pid_t jvm, const char *basedir, const char *self,
}
*arg++ = NULL;

setenv("CRAC_IMAGE_DIR", imagedir, 1);
char resolved_path[PATH_MAX];
if (realpath(imagedir, resolved_path) == NULL) {
perror("get real path for image dir error");
exit(1);
}
setenv("CRAC_IMAGE_DIR", resolved_path, 1);
execv(criu, (char **)args);
perror("criu dump");
exit(1);
Expand Down

0 comments on commit d6712d3

Please sign in to comment.