ConcurrentReferenceHashMap default DEFAULT_REFERENCE_TYPE #23284
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: declined
A suggestion or change that we don't feel we should currently apply
Hello,
We are currently facing an issue when successive redeployments happen. We get an java.lang.OutOfMemoryError: Metaspace. On redeployment, new classloaders are created but there are soft references which are kept in ConcurrentReferenceHashMap across spring core.
What we see as a general behavior is that softkeys are only freed on garbage collection if a certain memory threshold is reached in the heap memory. But there are cases where the keys retain classloaders which were dereferenced elsewhere on undeployment and in that case, if what is stressed is the metaspace we arrive to an OOM Metaspace because the softkeys are not freed in the heap memory.
We are currently considering to change the DEFAULT_REFERENCE_TYPE to WEAK through reflection, but taken into account the following comment:
#16021 (comment)
Shouldn't spring provide a way to change the default reference type which is now private?
Thanks in advance
The text was updated successfully, but these errors were encountered: