Unable to create snapshots with Java modules
Nikola Grcevski
grcevski at gmail.com
Tue Nov 29 16:36:32 UTC 2022
I found out the issue I had with my directory, I was using a symlinked file, so
the parent directory doesn't match the st_ino of the file. Perhaps
there's a much
better way, but I managed to get things to work with the following addition
(no symlink support):
static void mark_classpath_or_dir(FdsInfo *fds, char* cp) {
DIR *dir = os::opendir(cp);
if (!dir) {
mark_classpath_entry(fds, cp);
return;
}
os::closedir(dir);
mark_all_in(fds, cp);
}
...
do_classpaths(mark_classpath_or_dir, &fds, Arguments::get_appmodulepath());
I also had to make a small change in do_classpaths, at the end instead
of calling
mark_classpath_entry, I changed it to call fn(fds, cp).
On Tue, Nov 29, 2022 at 11:24 AM Nikola Grcevski <grcevski at gmail.com> wrote:
>
> Great, thanks!
>
> I started looking at it as well, I added
>
> arguments.cpp/hpp
> _java_module_path = new SystemProperty("jdk.module.path", "", true);
>
> and in os_linux.cpp
> do_classpaths(mark_classpath_entry, &fds, Arguments::get_appmodulepath());
>
> I was able to make things work if I put the expanded module path directly e.g:
> --module-path lib/simplemodule-1.0-SNAPSHOT.jar
>
> I'm not sure if there's a helper to expand the module path fully with
> directories, when I tried
> to create a mark function that handles both directories and files, the
> directory scan
> and mark never matches on my app lib directory on this check:
>
> if (dent->d_ino == fstat->st_ino)
>
> in os_linux::static void mark_all_in(FdsInfo *fds, char* dirpath).
>
> Thanks so much for your help.
> Nikola
>
> On Tue, Nov 29, 2022 at 11:11 AM Anton Kozlov <akozlov at azul.com> wrote:
> >
> > On 11/29/22 00:04, Nikola Grcevski wrote:
> > > However, if I try the same thing with the modules usage, the snapshot
> > > creation fails:
> > > ~/work/simplemodule$ /<path>/openjdk-17-crac+3_linux-x64/bin/java
> > > -XX:CRaCCheckpointTo=/tmp/simple --module-path lib --module
> > > simplemodule/co.elastic.simple.SimpleModule
> >
> > Hi Nikola,
> >
> > I've reproduced the problem. It seems JDK misses a piece of code for modules that is there for class loaders. It looks easy to fix, I'm looking at this.
> >
> > Meanwhile, while you're experimenting, you may disable CheckpointException by -XX:+UnlockExperimentalVMOptions -XX:-CRDoThrowCheckpointException. Of course, it's not recommended for anything beyond experiments :)
> >
> > Thanks,
> > Anton
More information about the crac-dev
mailing list