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

Limit the recursion depth on token graph for preventing StackOverflow #12359

Closed
jainankitk opened this issue Jun 9, 2023 · 1 comment
Closed
Labels

Comments

@jainankitk
Copy link
Contributor

jainankitk commented Jun 9, 2023

Description

For one of the customer workloads, saw the below error:

[2023-06-01T14:06:36,722][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [3d0cd173f993f66856fa05a22232a18f] fatal error in thread [elasticsearch[3d0cd173f993f66856fa05a22232a18f][search][T#12]], exiting
java.lang.StackOverflowError
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)
    at org.apache.lucene.util.graph.GraphTokenStreamFiniteStrings.articulationPointsRecurse(GraphTokenStreamFiniteStrings.java:277)

Although the customer acknowledged state explosion due to their malformed regex query, wondering if we should prevent the process from crashing by limiting the recursion depth?

Don't think there is much point writing this iteratively using stack, as we might run of heap memory still

Version and environment details

Lucene version - 8.7.0 with Elasticsearch 7.10.2

@jpountz
Copy link
Contributor

jpountz commented Jun 15, 2023

This will be fixed in Lucene 9.7: #12249.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants