-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Avoid OOM on poison documents #73460
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
Comments
Pinging @elastic/es-distributed (Team:Distributed) |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
The core-infra team discussed this in our sync today. We don't believe resiliency is the primary problem here. If we have a configured limit on the number of fields in a mapping, the code for the dynamic mappers should use that limit to avoid allocating too many objects whether or not the memory usage threatens OOM. If the only way to catch this issue were by using a memory circuit breaker, we'd consider that a resilience issue, but there is likely a better way to catch this by improving dynamic mappers. We think the search team is probably better equipped to handle this issue. |
Pinging @elastic/es-search (Team:Search) |
If dynamic mapping updates are enabled, having a crazy number of fields in a document can generate a very large dynamic mapping update that in turn can make a node go OOM even before the mapping update is validated. This commit adds a pre-flight check on the total number of fields allowed in a mapping at document parse time, while the (potentially large) dynamic mapping update is being built. Relates #73460
#73713 covers the scenario when a document has many different field names. There are scenarios which the PR does not cover, e.g. if the document has an array with a crazy number of subobjects that all have the same field name. We currently add a dynamic mapping update for all these subobjects fields, and only merge those later into one. This would only be solved by interleaving dynamic mapping creation with parsing, which isn’t easy to do. We could somewhat cover this scenario by also interleaving the index.mapping.nested_objects.limit + some other checks with parsing. |
If dynamic mapping updates are enabled, having a crazy number of fields in a document can generate a very large dynamic mapping update that in turn can make a node go OOM even before the mapping update is validated. This commit adds a pre-flight check on the total number of fields allowed in a mapping at document parse time, while the (potentially large) dynamic mapping update is being built. Relates #73460
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
In examining an OOM heap dump from a 7.12 user it was apparent that the culprit was a rogue document that introduced 360k(!) new fields and had a bunch of TextFieldMapper objects held in
o.e.index.mapper.ParseContext.InternalParseContext.dynamicMappers
that together consumed 1.5GB of RAM of 2GB heap.I know we have circuit breakers for numbers of fields in mappers but perhaps these objects are allocated during parsing before we test that condition?
Either way seems like we need some added robustness here.
The text was updated successfully, but these errors were encountered: