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.

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

Commit messages:
 - Add delay before full GC

Changes: https://git.openjdk.org/jdk/pull/10519/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10519&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8292879
  Stats: 10 lines in 1 file changed: 9 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/10519.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10519/head:pull/10519

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

Reply via email to