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

StackOverflowError when parsing deeply nested mappings #14370

Closed
ppf2 opened this issue Oct 29, 2015 · 6 comments
Closed

StackOverflowError when parsing deeply nested mappings #14370

ppf2 opened this issue Oct 29, 2015 · 6 comments
Labels
discuss :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one.

Comments

@ppf2
Copy link
Member

ppf2 commented Oct 29, 2015

Have a scenario where ES is throwing a StackOverflowError when the data node receives a cluster state published by the master. It is failing when parsing the mappings.

2015-10-27 00:23:50,561 [DEBUG] [service] [node_name] set local cluster state to version 575475 
2015-10-27 00:23:50,646 [WARN] [cluster] [node_name] [index_name] failed to add mapping [log], source [{"log":{"dynamic_templates":[{"facet_string_template":{"mapping":{"type":"multi_field","fields": 
... 
<a TON of mappings> 
... 
java.lang.StackOverflowError 
at org.elasticsearch.common.Strings.toUnderscoreCase(Strings.java:959) 
at org.elasticsearch.index.mapper.core.TypeParsers.parseField(TypeParsers.java:164) 
at org.elasticsearch.index.mapper.core.StringFieldMapper$TypeParser.parse(StringFieldMapper.java:153) 
at org.elasticsearch.index.mapper.core.TypeParsers.parseMultiField(TypeParsers.java:284) 
at org.elasticsearch.index.mapper.core.StringFieldMapper$TypeParser.parse(StringFieldMapper.java:184) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parse(ObjectMapper.java:189) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseProperties(ObjectMapper.java:290) 
at org.elasticsearch.index.mapper.object.ObjectMapper$TypeParser.parseObjectOrDocumentTypeProperties(ObjectMapper.java:214) 

In this particular case, there is an explosion in mapped fields due to dynamically created fields where a single field ends up having many many levels of nesting (recursion). As a result, StackOverflowError shows up whenever the mappings has to be parsed so that the nodes cannot process the updates.

It will probably be helpful if we have a sensible default to limit the number of depth levels for a field, etc..

@dakrone
Copy link
Member

dakrone commented Oct 30, 2015

@ppf2 it sounds reasonable to me to have a sensible default to the limit. Do you know how deep these mappings went? Could we reasonably pick "100" as the limit for nesting?

@ppf2
Copy link
Member Author

ppf2 commented Oct 30, 2015

@dakrone Will send you a sample offline. I think we can choose a default, and also expose this as a configurable setting?

@rjernst
Copy link
Member

rjernst commented Oct 30, 2015

100 seems crazy high to me. foo.bar.baz.a.b.c.d.e.f.g is already 10 levels deep and that is crazy...

@dakrone
Copy link
Member

dakrone commented Oct 30, 2015

@ppf2 We don't need a sample, I was just curious the number of levels it went down (not the actual mapping)

@ppf2
Copy link
Member Author

ppf2 commented Oct 30, 2015

@dakrone In this case, easily > 500 levels 😮

@clintongormley
Copy link

Closing in favour of #11511

@clintongormley clintongormley added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. and removed :Cluster labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one.
Projects
None yet
Development

No branches or pull requests

4 participants