Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[JENKINS-15156] Class loading errors can result from OOME if you are …
…not careful.
- Loading branch information
74e6409
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnou was curious about this commit, so for the record:
If you do not do this, it is possible that a concurrent class load will get an
OutOfMemoryError
(collateral damage), and Java will not try reloading it. So you getNoClassDefFoundError
s on that class henceforth, which can send everything south. I saw this onComputerSet
when I tried to run the test. The originalassertGC
is smarter because it actually tries to callSystem.gc
and check if theWeakReference
is collected before “escalating” the memory pressure to the point of anOutOfMemoryError
.