RFR[13]: 8227277: HeapInspection::find_instances_at_safepoint walks dead objects

Thomas Schatzl thomas.schatzl at oracle.com
Mon Jul 8 07:00:44 UTC 2019


Hi,

On Fri, 2019-07-05 at 12:19 +0200, Erik Österlund wrote:
> Hi,
> 
> In the HeapInspection::find_instances_at_safepoint function, the
> unsafe heap iteration API (which also walks dead objects) is used to
> find objects that are instance of a class, used for concurrent lock
> dumping where we find 
> dead java.util.concurrent.locks.AbstractOwnableSynchronizer objects
> and pointer chase to its possibly dead owner threadObj. There is a
> comment saying that if this starts crashing because we use CMS, we
> should probably change to use the safe_object_iterate() API instead,
> which does not include dead objects.
> 
> Arguably, whether CMS is observed to crash or not, we really should
> not be walking over dead objects and exposing them anyway. It's not
> safe... and it will crash sooner or later.

[...]

> This will all eventually end up in a glorious crash. So we shouldn't
> do this.
> 
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8227277
> 
> Webrev:
> http://cr.openjdk.java.net/~eosterlund/8227277/webrev.00/

  looks good.

Thomas



More information about the hotspot-dev mailing list