Skip to content

Call to TypeVariable.getBounds() without synchronization unsafe on some platforms #1408

@ThomasKrieger

Description

@ThomasKrieger

The method com/fasterxml/jackson/databind/type/TypeFactory._fromVariable calls TypeVariable.getBounds() from multiple threads. TypeVariable.getBounds() is in the current implementation not thread
safe: sun/reflect/generics/reflectiveObjects/TypeVariableImpl.getBounds.

Here is the stack trace found by vmlens, a tool to test multithreaded java:
sun/reflect/generics/reflectiveObjects/TypeVariableImpl.getBounds
com/fasterxml/jackson/databind/type/TypeFactory._fromVariable
com/fasterxml/jackson/databind/type/TypeFactory._fromAny
com/fasterxml/jackson/databind/type/TypeFactory._fromParamType
com/fasterxml/jackson/databind/type/TypeFactory._fromAny
com/fasterxml/jackson/databind/type/TypeFactory._resolveSuperClass
com/fasterxml/jackson/databind/type/TypeFactory._fromClass
com/fasterxml/jackson/databind/type/TypeFactory._fromAny
com/fasterxml/jackson/databind/type/TypeFactory.constructType
com/fasterxml/jackson/databind/ObjectMapper.readValue
com/vmlens/testMultithreadedJson/jackson/JacksonLocalVariable.testRead

I used version 2.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions