Toparvion
Toparvion

Reputation: 829

What does "Not linked" mean in Dynamic CDS Archive log?

I'm trying to use JDK 13's JEP-350 "Dynamic CDS Archives" with real (not academic) application.
For this, I've added -XX:ArchiveClassesAtExit=, -Xlog:class+load=debug and -Xlog:cds=debug JVM options to my application startup script. When the application finishes and HotSpot starts creating the shared archive, the log is populated with a lot of warnings like:

[215.210s][warning][cds] Skipping tech/toparvion/analog/remote/agent/si/ContainerTargetFile: Not linked

But the same class in class loading log shows nothing suspicious:

[121.323s][info ][class,load] tech.toparvion.analog.remote.agent.si.ContainerTargetFile source: file:/E:/Issues/Temp/deploy-v0.12/lib/analog/lib/analog.slim.jar
[121.323s][debug][class,load]  klass: 0x0000000801072ce0 super: 0x00000008002ea5e0 loader: [loader data: 0x000001dc2aba5eb0 for instance a 'jdk/internal/loader/ClassLoaders$AppClassLoader'{0x0000000702300000}] bytes: 1305 checksum: 1645a974

There are 1824 such skipped classes (both application and library) of 10566 total classes used by the application (including ≈500 generated). I know that far not all classes can be put into the shared archive but here I get ≈18% of skipped classes which seem a significant lack of CDS efficiency.

So the questions are:

  1. Why the classes are skipped?
  2. What should I do to avoid skipping and include them into the archive?

UPDATE
I've repeated the same experiment with a static AppCDS archive and it worked, i.e. ContainerTargetFile class has been successfully stored into the shared archive as well as hundreds of other classes. Thus, the aforementioned issue seems to concern Dynamic CDS Archives only.

Upvotes: 4

Views: 649

Answers (1)

Arthur Branham
Arthur Branham

Reputation: 31

I had a similar experience while testing this feature. Nearly all the classes were skipped due to a reason of "Not linked". Further search on openjdk yielded an interesting issue with a link to source code. If you examine the should_be_excluded function there are some useful comments that explain the exclusions, their rationale,and limitations. In particular there appears to be an issue with Linking at JVM exit, which is when the ArchiveClassesAtExit occurs.

https://bugs.openjdk.java.net/browse/JDK-8232081

http://hg.openjdk.java.net/jdk/jdk/file/23a06a5eeddd/src/hotspot/share/classfile/systemDictionaryShared.cpp#l1081 http://hg.openjdk.java.net/jdk/jdk/file/23a06a5eeddd/src/hotspot/share/classfile/systemDictionaryShared.cpp#l1116

Upvotes: 3

Related Questions