During CDS dump, we enter a safepoint (e.g., VM_PopulateDynamicDumpSharedSpace) and run ArchiveBuilder::gather_source_objs() to collect all classes to be dumped. However, some of these classes may belong to custom class loaders that are no longer referenced. While we are still inside the safepoint, concurrent GC operations may free these class loaders (see
JDK-8267879). Thus ArchiveBuilder may end up referencing unloaded classes.