<Beans Dev> Integrated: 8231454: File lock in Windows on a loaded jar due to a leak in Introspector::getBeanInfo
Sergey Bylokhov
serb at openjdk.java.net
Wed Oct 21 02:08:16 UTC 2020
On Wed, 14 Oct 2020 05:18:23 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> java.beans.Introspector is using a new cache mechanism since Java9 in com.sun.beans.introspect.ClassInfo::CACHE which
> uses a SoftReference cache over the class, which makes the class "leak", unless clearing the cache manually or
> collecting the SoftReference by the GC. Note that this is not a pure "leak", because the SoftReference will be
> collected if there is no enough memory on the system, but if the heap is big enough then all objects referenced from
> the cached class will be in the memory. The class has a reference to the ClassLoader, and If the soft reference to the
> class is not collected by the GC, then the ClassLoader cannot be unloaded and this block the jar file removing.
> The solution is to update the implementation of Introspector.flushCaches()/flushFromCaches(Class) to clear the whole
> cache or the cache for the specific class.
This pull request has now been integrated.
Changeset: 2ee2b4ae
Author: Sergey Bylokhov <serb at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/2ee2b4ae
Stats: 113 lines in 3 files changed: 109 ins; 1 del; 3 mod
8231454: File lock in Windows on a loaded jar due to a leak in Introspector::getBeanInfo
Reviewed-by: kizune
-------------
PR: https://git.openjdk.java.net/jdk/pull/647
More information about the beans-dev
mailing list