Skip to content

Classloader leak: DEFAULT_ANNOTATION_INTROSPECTOR holds annotation reference (JBoss) #3771

@ciis0

Description

@ciis0

Describe the bug
A clear and concise description of what the bug is.

Similar to #3093, in JBoss JacksonAnnotationIntrospector._annotationsInside, referenced statically via ObjectMapper.DEFAULT_ANNOTATION_INTROSPECTOR, might contain references to annotations from Deployment Class-Loaders, which leads to leaking those when the deployment is stopped/undeployed.

Version information
Which Jackson version(s) was this for?

2.13.4.2, but from the code it looks like it's still true today.

protected final static AnnotationIntrospector DEFAULT_ANNOTATION_INTROSPECTOR = new JacksonAnnotationIntrospector();

protected transient LRUMap<Class<?>,Boolean> _annotationsInside = new LRUMap<Class<?>,Boolean>(48, 48);

To Reproduce

https://github.com/ciis0/jackson-3771

Expected behavior
If reproduction itself needs further explanation, you may also add more details here.

Additional context
Add any other context about the problem here.

Reference to annotation class from deployment class-loader in JacksonAnnotationIntrospector instance:

image

Static reference to that annotation introspector instance from ObjectMapper:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    to-evaluateIssue that has been received but not yet evaluated

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions