[ 
https://issues.apache.org/jira/browse/SOLR-16567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17648909#comment-17648909
 ] 

Gabriel Magno edited comment on SOLR-16567 at 12/17/22 2:32 PM:
----------------------------------------------------------------

Hi [~abenedetti] !

I think this could fix the issue indeed.

Earlier this week I've taken a look at the cost feature inside the Solr code. 
For instance, I have seen that the Function Range Filter Query object sets its 
cost as 100 by default.

The problem I had was that the cost parameters (and the query filter objects) 
are only available as a result from the `parse` function, and the parse 
function is precisely the function that causes the Stack Overflow (frange.parse 
tries to parse KNN, which tries to parse all the filters, then tries to parse 
frange, which parses KNN, etc). Before calling the parse we do have the 
"Parser" object, but it does not have information about the costs yet.

Anyhow, you can definetely proceed with a PR, that would be really appreciated 
:)


was (Author: gmagno):
Hi [~abenedetti] !

I think this could fix the issue indeed.

Earlier this week I've taken a look at the cost feature inside the Solr code. 
For instance, I have seen that the Function Range Filter Query object sets its 
cost as 100 by default. 

The problem I had was that the cost parameters (and the query filter objects) 
are only available as a result from the `parse` function, and the parse 
function is precisely the function that causes the Stack Overflow (frange.parse 
tries to parse KNN, which tries to parse all the filters, then tries to parse 
frange, which parses KNN, etc). Before calling the parse we do have the 
"Parser" object, but it does not have informativo about the costs yet.

Anyhow, you can definetely proceed with a PR, that would be really appreciated 
:)

> java.lang.StackOverflowError when combining KnnQParser and 
> FunctionRangeQParser
> -------------------------------------------------------------------------------
>
>                 Key: SOLR-16567
>                 URL: https://issues.apache.org/jira/browse/SOLR-16567
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: query
>    Affects Versions: 9.1
>         Environment: Solr Cloud with `solr:9.1` Docker image
>            Reporter: Gabriel Magno
>            Priority: Major
>         Attachments: create_example-solr_9_0.sh, create_example-solr_9_1.sh, 
> error_full.txt, response-error.json, run_query.sh
>
>
> Hello there!
> I had a Solr 9.0 cluster running, using the new Dense Vector feature. 
> Recently I have migrated to Solr 9.1. Most of the things are working fine, 
> except for a special case I have here.
> *Error Description*
> The problem happens when I try making an Edismax query with a KNN sub-query 
> and a Function Range filter. For example, I try making this query.
>  * defType=edismax
>  * df=name
>  * q=the
>  * similarity_vector=\{!knn f=vector topK=10}[1.1,2.2,3.3,4.4]
>  * {!frange l=0.99}$similarity_vector
> In other words, I want all the documents matching the term "the" in the 
> "name" field, and I filter to return only documents having a vector 
> similarity of at least 0.99. This query was working fine on Solr 9.0, but on 
> Solr 9.1, I get his error:
>  
> {code:java}
> java.lang.RuntimeException: java.lang.StackOverflowError    at 
> org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:840)    at 
> org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:641)    at 
> org.apache.solr.servlet.SolrDispatchFilter.dispatch(SolrDispatchFilter.java:250)
>     at 
> org.apache.solr.servlet.SolrDispatchFilter.lambda/usr/bin/zsh(SolrDispatchFilter.java:218)
>     at 
> org.apache.solr.servlet.ServletUtils.traceHttpRequestExecution2(ServletUtils.java:257)
>     at 
> org.apache.solr.servlet.ServletUtils.rateLimitRequest(ServletUtils.java:227)  
>   at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:213)
>     at 
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:195)
>     at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201) 
>    ... (manually supressed for brevity)    at 
> java.base/java.lang.Thread.run(Unknown Source)Caused by: 
> java.lang.StackOverflowError    at 
> org.apache.solr.search.StrParser.getId(StrParser.java:172)    at 
> org.apache.solr.search.StrParser.getId(StrParser.java:168)    at 
> org.apache.solr.search.QueryParsing.parseLocalParams(QueryParsing.java:100)   
>  at 
> org.apache.solr.search.QueryParsing.parseLocalParams(QueryParsing.java:65)    
> at org.apache.solr.search.QParser.getParser(QParser.java:364)    at 
> org.apache.solr.search.QParser.getParser(QParser.java:334)    at 
> org.apache.solr.search.QParser.getParser(QParser.java:321)    at 
> org.apache.solr.search.QueryUtils.parseFilterQueries(QueryUtils.java:244)    
> at 
> org.apache.solr.search.neural.KnnQParser.getFilterQuery(KnnQParser.java:93)   
>  at org.apache.solr.search.neural.KnnQParser.parse(KnnQParser.java:83)    at 
> org.apache.solr.search.QParser.getQuery(QParser.java:188)    at 
> org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:384)
>     at org.apache.solr.search.FunctionQParser.parse(FunctionQParser.java:94)  
>   at org.apache.solr.search.QParser.getQuery(QParser.java:188)    at 
> org.apache.solr.search.FunctionRangeQParserPlugin.parse(FunctionRangeQParserPlugin.java:53)
>     at org.apache.solr.search.QParser.getQuery(QParser.java:188)    at 
> org.apache.solr.search.QueryUtils.parseFilterQueries(QueryUtils.java:246)    
> at 
> org.apache.solr.search.neural.KnnQParser.getFilterQuery(KnnQParser.java:93)   
>  at org.apache.solr.search.neural.KnnQParser.parse(KnnQParser.java:83)    at 
> org.apache.solr.search.QParser.getQuery(QParser.java:188)    at 
> org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:384)
>     at org.apache.solr.search.FunctionQParser.parse(FunctionQParser.java:94)  
>   at org.apache.solr.search.QParser.getQuery(QParser.java:188)    at 
> org.apache.solr.search.FunctionRangeQParserPlugin.parse(FunctionRangeQParserPlugin.java:53)
>     at org.apache.solr.search.QParser.getQuery(QParser.java:188)    ... 
> (manually supressed for brevity){code}
>  
> The backtrace is much bigger, I'm attaching the raw Solr response in JSON 
> (which is truncated) in {_}*response-error.json*{_}, and the full error 
> message in _*error_full.txt*_ . Apparently there is an infinite loop on the 
> error message that same 9 backtrace entries are repeated ad-infinitum, so I 
> believe this is the reason the error message Solr gives is truncated.
> *How to Reproduce the Error*
> I was able to create an small reproducible example to replicate the error. It 
> creates a collection with two fields, and index 2 example documents. I 
> provide the bash scripts to create the collections, and also the script to 
> make the query. These are the scripts:
>  * {*}create_example-solr_9_0.sh{*}: creates the collection, the fields, 
> schema and index example documents for Solr 9.0.
>  * {*}create_example-solr_9_1.sh{*}: creates the collection, the fields, 
> schema and index example documents for Solr 9.1.
>  * {*}run_query.sh{*}: executes the query that will responde correctly on 
> Solr 9.0, and will return a Java Stack Overflow error on Solr 9.1.
> I have created separated scripts for Solr 9.0 and Solr 9.1 because of the 
> change on the parameters of the Dense Vector field, which when from 
> codecFormat to knnAlgorithm. So the two scripts differ only when defyning the 
> vector field type.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to