JDK-8177703 : Logging for gc+humongous potentially accesses klasses of dead objects
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 9,10
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2017-03-28
  • Updated: 2022-09-20
  • Resolved: 2022-09-20
Related Reports
Relates :  
Relates :  
Description
During the investigation of JDK-8153843 we noticed that the code for printing gc+humongous logging accesses the klass of the objects that are reclaimed via the size() method during eager reclaim.

At the moment this is not critical as eager reclaim only over selects humongous objects of typeArray kind, which is never unloaded.

However this should be fixed in preparation for more extensive reclamation.

One idea would be to only access obj->size() in the log message if it is safe to do so, otherwise print an estimate (using regions), or just the number of regions.
Comments
In the end this is a totally safe access of obj->size() for an object we just found to be dead in the pause, so closing as WNF.
20-09-2022

This is very conservative: when we are doing eager reclaim during young gc we never unload classes during young gc. So while the code accesses a class that has just been eagerly reclaimed and kind of dead, accessing the klass should be "okay" anyway if I understand correctly.
09-11-2017