-
Notifications
You must be signed in to change notification settings - Fork 767
RAM Class Persistence: Introducing Frozen Classes #22063
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
Conversation
@babsingh @TobiAjila @dmitripivkine I checked all gc policies using pingLiberty server program, please have a look. |
|
I don't like this solution at all. Make j9classes hidden for GC it is bad idea. |
We are caching RAM classes during shutdown in the snapshot, similar to how ROM classes are handled with the Shared Classes Cache. Currently, only the native portions of the During the restore phase, the snapshot is loaded during JVM initialization. However, the corresponding Java objects are not yet initialized; they will be created later through their normal code paths. Despite this, the native structures from the snapshot become visible to the garbage collector as soon as the snapshot is loaded. The goal is to delay the exposure of these native structures to the GC until their associated Java objects are fully initialized through standard execution paths. |
I will include the update |
84ee554
to
157d324
Compare
As per our Teams meeting with @TobiAjila and @amicic, the PR is revised to implement the frozen class into the common class iterator interfaces. |
@lzhou2025 The PR description is slightly inaccurate. We are not freezing the j9class objects; we are freezing j9classes until their classObjects are initialized. Also, the Updated version of the commit message and PR description:
In the PR description, the title is repeated, which should be fixed. Can you confirm if #21892 is fixed through local testing once the changes are finalized? |
Will check it. |
7002eec
to
865c696
Compare
I pushed the update, but leave null check. The problem is that if delete "null check", jvm crashes. I spent some time to debug the crash, it appears that those "null check" is applied to classes loaded by the application class loader (saved in snapshot) from the snapshot run, in restore, the class loader is ignored, unused, but new application class loader is created instead openj9/runtime/jcl/common/stdinit.c Line 468 in f255919
|
fe206bc
to
5150e32
Compare
Could someone please expand "RCP" in this context, please? |
RCP – RAM Class Persistence: This refers to the caching of RAM classes in snapshots so they can be reused in subsequent runs. |
afc3674
to
36a6020
Compare
Both the commit message and the description here should spell that out. |
Updated |
@dmitripivkine Has this changed sufficiently to address your concern? |
Suggested way of handling of Frozen classes (hiding from GC) introduces number of limitations how such classes should be treated. So, VM component is taking responsibility for correctness. I have suggested to add assertions to control Frozen classes isolation:
|
This is an implilied restriction as we dont have to the ability to cache classes from non-peristent classloaders
All cached classes have empty constantpools and statics so Frozen classes cant be discovered until they are loaded from the cache (which transforms the class from a frozen to a normal class).
This is the current behaviour. This PR doesnt change the contract with the GC, |
jenkins test sanity.functional amac jdk17 |
During snapshot creation, the J9Class structures whose class loader is application class loader are marked as frozen when their classObject fields are nullified. During the restore phase, these structures are never used, kept hidden from the GC and other external users as a limitation. This is achieved by updating the skip logic in the J9HashTable, J9MemorySegment Iterator, which prevents the GC from encountering J9Class structures in an unusable state that could lead to crashes. The class ClassHeapIterator is refactored to use a generic vm interface segmentIteratorNextClass() to iterate over classes in a segment. Fixes: eclipse-openj9#21892 Co-authored-by: Babneet Singh [email protected] Co-authored-by: Tobi Ajila [email protected] Co-authored-by: Lige Zhou [email protected]
For the record, the build underway is at https://openj9-jenkins.osuosl.org/job/PullRequest-OpenJ9/7782. |
I will cancel my job, I didn't notice that there is "PullRequest-OpenJ9" under job. |
There's no need to cancel that job; it completed successfully. |
``
Perfect |
During snapshot creation, the J9Class structures whose class loader is
application class loader are marked as frozen when their classObject
fields are nullified. During the restore phase, these structures are never
used, kept hidden from the GC and other external users as a limitation.
This is achieved by updating the skip logic in the J9HashTable,
J9MemorySegment Iterator, which prevents the GC from encountering
J9Class structures in an unusable state that could lead to crashes.
The class ClassHeapIterator is refactored to use a generic vm interface
segmentIteratorNextClass() to iterate over classes in a segment.
Fixes: #21892
Co-authored-by: Babneet Singh [email protected]
Co-authored-by: Tobi Ajila [email protected]
Co-authored-by: Lige Zhou [email protected]