Closed
Description
Problem:
The lifecycle of SimpleObjectIdResolver
is obviously meant to be scoped by a call to Object{Mapper,Reader}.readValue()
, since it is not threadsafe and accumulates ids forever. However, it is getting cached along with long-lived deserializers, and re-used across threads and across multiple calls to Object{Mapper,Reader}.readValue()
. This violates thread safety and is a memory leak.
Jackson version: 2.4+ (ObjectIdResolver
appears not to exist in <2.4).
How to reproduce:
- Make a class
Foo
that uses object ids with@JsonIdentityInfo
- Write code like
String json = mapper.writeValueAsString(...);
mapper.readValue(json, Foo.class);
mapper.readValue(json, Foo.class);
- Put breakpoint in
SimpleObjectIdResolver
's constructor
Expected results:
SimpleObjectIdResolver
is constructed twice (once per call to readValue()
).
Observed results:
SimpleObjectIdResolver
is constructed only once.
Metadata
Metadata
Assignees
Labels
No labels