Skip to content

@JsonTypeInfo non-deterministically ignored in 2.5.1 #738

Closed
@dylanscott

Description

@dylanscott

We're observing what appears to be a race condition in Jackson 2.5.1, where a particular use of @JsonTypeInfo will non-deterministically get ignored when writing JSON. I have a small test case which for me reproduces the issue 30-50% of the time. We're copying the structure of a type in our application, which looks like the following:

          HasSubTypes (interface)
               |
       AbstractHasSubTypes (uses @JsonTypeInfo and @JsonSubTypes, serializing as wrapper object)
       /       |         \
TypeOne     TypeTwo     TypeThree

We mixin AbstractHasSubTypes' annotations with HasSubTypes, and then serialize a Wrapper object which has a single field of type HasSubTypes. There appears to be a race condition when serializing these wrapper objects in parallel, where some percentage of the time the @JsonTypeInfo information is completely ignored and we don't serialize any type information. The linked test case should hopefully make this clearer, it's pretty small. This issue does not appear to affect 2.4.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions