- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    None
- 
        b03
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8270720 | 17.0.1 | Ioi Lam | P4 | Resolved | Fixed | b03 | 
| JDK-8269963 | 17 | Ioi Lam | P4 | Resolved | Fixed | b30 | 
                    Today we call SystemDictionaryShared::check_excluded_classes() before holding the DumpTimeTable_lock:
https://github.com/openjdk/jdk/blob/0b09129faefb945c2f2c35dab2731961216d054e/src/hotspot/share/cds/metaspaceShared.cpp#L490
SystemDictionaryShared::check_excluded_classes();
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
It's possible for concurrent class unloading to modify the dumptime table where SystemDictionaryShared::remove_dumptime_info is called from here:
0 InstanceKlass::unload_class
1 ClassLoaderData::classes_do
2 ClassLoaderData::unload
3 ClassLoaderDataGraph::do_unloading
4 SystemDictionary::do_unloading
5 ZUnload::unlink
6 ZHeap::process_non_strong_references
7 ZDriver::concurrent_process_non_strong_references
8 ZDriver::gc
9 ZDriver::run_service
10 ConcurrentGCThread::run
Fix: the above two source lines should be swapped.
https://github.com/openjdk/jdk/blob/0b09129faefb945c2f2c35dab2731961216d054e/src/hotspot/share/cds/metaspaceShared.cpp#L490
SystemDictionaryShared::check_excluded_classes();
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
It's possible for concurrent class unloading to modify the dumptime table where SystemDictionaryShared::remove_dumptime_info is called from here:
0 InstanceKlass::unload_class
1 ClassLoaderData::classes_do
2 ClassLoaderData::unload
3 ClassLoaderDataGraph::do_unloading
4 SystemDictionary::do_unloading
5 ZUnload::unlink
6 ZHeap::process_non_strong_references
7 ZDriver::concurrent_process_non_strong_references
8 ZDriver::gc
9 ZDriver::run_service
10 ConcurrentGCThread::run
Fix: the above two source lines should be swapped.
- backported by
- 
                    JDK-8269963 CDS check_excluded_classes needs DumpTimeTable_lock -           
- Resolved
 
-         
- 
                    JDK-8270720 CDS check_excluded_classes needs DumpTimeTable_lock -           
- Resolved
 
-         
- relates to
- 
                    JDK-8268139 CDS ArchiveBuilder may reference unloaded classes -           
- Resolved
 
-         
- links to
- 
                     Commit
        openjdk/jdk17/0ebf8aa9 Commit
        openjdk/jdk17/0ebf8aa9
- 
                     Commit
        openjdk/jdk/e4908a43 Commit
        openjdk/jdk/e4908a43
- 
                     Review
        openjdk/jdk17/220 Review
        openjdk/jdk17/220
- 
                     Review
        openjdk/jdk/4494 Review
        openjdk/jdk/4494
             (2 links to)