Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: StackOverflowError with recursive types that contain Map.Entry #938

Closed
jloisel opened this issue Sep 17, 2015 · 6 comments
Closed
Milestone

Comments

@jloisel
Copy link

jloisel commented Sep 17, 2015

Hi,

I encounter the following issue with 2.6.x (works fine with 2.5.4):

java.lang.StackOverflowError
at com.fasterxml.jackson.databind.type.ClassKey.(ClassKey.java:43)
at com.fasterxml.jackson.databind.type.TypeFactory._fromClass(TypeFactory.java:869)
at com.fasterxml.jackson.databind.type.TypeFactory._constructType(TypeFactory.java:480)
at com.fasterxml.jackson.databind.type.TypeBindings._resolveBindings(TypeBindings.java:314)
at com.fasterxml.jackson.databind.type.TypeBindings._resolve(TypeBindings.java:212)
at com.fasterxml.jackson.databind.type.TypeBindings.findType(TypeBindings.java:126)
at com.fasterxml.jackson.databind.type.TypeFactory._fromVariable(TypeFactory.java:1068)
at com.fasterxml.jackson.databind.type.TypeFactory._constructType(TypeFactory.java:493)
at com.fasterxml.jackson.databind.type.TypeFactory.findTypeParameters(TypeFactory.java:397)
at com.fasterxml.jackson.databind.type.TypeFactory.findTypeParameters(TypeFactory.java:373)
at com.fasterxml.jackson.databind.type.TypeFactory._fromParamType(TypeFactory.java:1032)
at com.fasterxml.jackson.databind.type.TypeFactory._constructType(TypeFactory.java:484)
at com.fasterxml.jackson.databind.type.TypeBindings._resolveBindings(TypeBindings.java:267)
at com.fasterxml.jackson.databind.type.TypeBindings._resolveBindings(TypeBindings.java:328)
at com.fasterxml.jackson.databind.type.TypeBindings._resolve(TypeBindings.java:212)
at com.fasterxml.jackson.databind.type.TypeBindings.findType(TypeBindings.java:126)
at com.fasterxml.jackson.databind.type.TypeFactory._fromVariable(TypeFactory.java:1068)
...

The JUnit which shows how to reproduce the error:
https://gist.github.com/jloisel/1d36c017f5b27617c27b

@jloisel jloisel changed the title Stackoverflow when serializing List<Pair<String,Double>> with 2.6.x Regression: Stackoverflow when serializing List<Pair<String,Double>> with 2.6.x Sep 17, 2015
@jloisel jloisel changed the title Regression: Stackoverflow when serializing List<Pair<String,Double>> with 2.6.x Regression: StackOverflowError with with 2.6.x (2.5.4 works fine) Sep 17, 2015
@jloisel
Copy link
Author

jloisel commented Sep 23, 2015

Maybe be better if we comment the issue here, not on the gist 👍

@cowtowncoder
Copy link
Member

@jloisel haven't had time to dig into this yet. It does seem odd that there is discrepancy here.
I am guessing that it should be possible to further isolate the problem wrt datatype on common-lang (as per test project), but simply construct JavaType for it, instead of going through serialize or deserialize.
But I will try to find time to troubleshoot the problem as is; obviously there is something wrong going on.

@jloisel
Copy link
Author

jloisel commented Sep 23, 2015

I'm going to try to isolate it further too. If i find something i'll let you know here.

@jloisel
Copy link
Author

jloisel commented Sep 23, 2015

I isolated the bug a bit more:
https://gist.github.com/jloisel/c75ed016fd6607508ad7

It seems like it's related to the implemented interfaces which reference the type itself. I removed all external dependencies.

@cowtowncoder
Copy link
Member

Thanks. There are known open issues wrt resolution of recursive type definitions (oldest open being #76 I think). What is odd is rather that this would surface between 2.5 and 2.6; not its existence.
Especially since support for Map.Entry itself was added in 2.5.

cowtowncoder added a commit that referenced this issue Sep 23, 2015
@cowtowncoder cowtowncoder changed the title Regression: StackOverflowError with with 2.6.x (2.5.4 works fine) Regression: StackOverflowError with recursive types that contain Map.Entry Sep 23, 2015
@cowtowncoder cowtowncoder added this to the 2.6.3 milestone Sep 23, 2015
@cowtowncoder
Copy link
Member

I think I know which change triggered the problem; TypeFactory actually proactively resolves Map.Entry type parameterization with 2.6. It should have been resolved by code anyway, at a later point, but probably either wasn't, or used slightly different code path.

I was also able to change code to work for the test case that resolves type; although now that I write this I realized I need to go back and verify that actual deserialization also works, just to be sure.

cowtowncoder added a commit that referenced this issue Sep 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants