RFR: 8326820: Metadata artificially kept alive [v3]

Stefan Karlsson stefank at openjdk.org
Thu Jun 20 16:56:10 UTC 2024


On Thu, 20 Jun 2024 16:30:30 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> If the default is to not keep the CLD alive, I don't like that we need the details of the side effect in the name. Just call it classes_do, etc. I don't care about no-keepalive in all these callers, if that's the right answer for most of these callers. Put the side effect in the name of the exceptional cases.

I disagree and probably urged/influenced Axel to name these functions this way. Very few people understand that they need to be careful around liveness of CLDs and klasses when they use these iterators/visitors. We keep seeing bugs in this area. Either because the devs fail to keep the klasses alive, or as in this bug, all klasses become kept alive. We want a name that strongly suggests that these functions are not as innocent as one might think, and that if you are going to use these functions you need to go an look at the comments (or ask someone) what we mean with no-keepalive.

> 
> We had the iterator keep things alive for safety in the cases where we could have the CLD unload while we were looking at it.

It turns out that that safety causes significant problems for seldomly run, concurrent marking GCs. If you repeatedly use any of these APIs you in effect turn off class unloading when running wit ZGC.

> In all these cases, this wasn't needed?

We don't think they are. It would be great if you could take an extra close look at the class redefinition code.

> Still have to work through that.

Thanks!

-------------

PR Comment: https://git.openjdk.org/jdk/pull/19769#issuecomment-2181139233


More information about the serviceability-dev mailing list