On Sat, 1 Oct 2022 01:12:52 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

> The bug is due to the debug agent still having a reference to one of the 
> classes when the full GC is issued by the debuggee, thus keeping the classes 
> loaded. The debug agent it about to free the reference, but doesn't do it 
> quite soon enough, and then it is blocked from freeing it by the full GC. It 
> does free it after the full GC, but by then it is too late, and the full GC 
> has already failed to unload all the classes.
> 
> The debug agent class reference is coming from the ClassPrepareEvent that is 
> sent for the last class loaded. The event has been sent to the debugger and 
> the debug agent is about to free the reference, but the debuggee main thread 
> has already resumed and gets to the full GC first. Adding a short delay in 
> the debuggee main thread allows the debug agent to finish freeing the 
> reference before the full GC is done.

This pull request has now been integrated.

Changeset: 6a266c4d
Author:    Chris Plummer <cjplum...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/6a266c4de15d04d50928b68f9b2dbb69911cff13
Stats:     11 lines in 1 file changed: 9 ins; 0 del; 2 mod

8292879: com/sun/jdi/ClassUnloadEventTest.java failed due to classes not 
unloading

Reviewed-by: dholmes, coleenp, sspitsyn

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

PR: https://git.openjdk.org/jdk/pull/10519

Reply via email to