Hello,

I've observed the following error after 9.4.0. I've described the main issue, 
potential root cause and steps to reproduce if it helps.

Issue

When the boosting function is used with a constant term AND when the debug mode 
is enabled at the query level (i.e. {!boost b=2} and &debug=query), the 
response errors out with IllegalAccessException. This is a rather unexpected 
behavior where debugging blocks the query response.


Affected versions

I can confirm this behavior was introduced from the 9.4.0 release which was 
most likely coming from https://github.com/apache/solr/pull/1867, which 
modifies the serialization logic. Specifically, the error is thrown in 
https://github.com/gerlowskija/solr/blob/65aa5b96286873bc0c6599379de0d06c363da1a6/solr/solrj/src/java/org/apache/solr/common/util/Utils.java#L857

Steps to reproduce

Following 
https://solr.apache.org/guide/solr/latest/getting-started/tutorial-vectors.html,
$ bin/solr start
$ bin/solr create -c films
$ curl http://localhost:8983/solr/films/schema -X POST -H 
'Content-type:application/json' --data-binary '{
  "add-field-type" : {
    "name":"knn_vector_10",
    "class":"solr.DenseVectorField",
    "vectorDimension":10,
    "similarityFunction":"cosine",
    "knnAlgorithm":"hnsw"
  },
  "add-field" : [
      {
        "name":"film_vector",
        "type":"knn_vector_10",
        "indexed":true,
        "stored":true
      },
      {
        "name":"name",
        "type":"text_general",
        "multiValued":false,
        "stored":true
      },
      {
        "name":"initial_release_date",
        "type":"pdate",
        "stored":true
      }
    ]
}'
$ bin/solr post -c films example/films/films.json
Running this following query returns an error response with the serialization 
error
http://localhost:8983/solr/films/query?q={!boost%20b=2}{!knn%20f=film_vector%20topK=50}[-0.1784,0.0096,-0.1455,0.4167,-0.1148,-0.0053,-0.0651,-0.0415,0.0859,-0.1789]&debug=query

{
  "error":{
    "msg":"java.lang.IllegalAccessException: access violation: class 
org.apache.solr.search.ValueSourceParser$LongConstValueSource, from public 
Lookup",
    "trace":"java.lang.RuntimeException: java.lang.IllegalAccessException: 
access violation: class 
org.apache.solr.search.ValueSourceParser$LongConstValueSource, from public 
Lookup\n\tat 
org.apache.solr.common.util.Utils.getReflectWriter(Utils.java:879)\n\tat 
org.apache.solr.common.util.TextWriter.writeVal(TextWriter.java:114)\n\tat 
org.apache.solr.response.TextResponseWriter.writeVal(TextResponseWriter.java:213)\n\tat
 org.apache.solr.common.util.TextWriter.writeVal(TextWriter.java:48)\n\tat 
org.apache.solr.common.util.JsonTextWriter.writeNamedListAsMapWithDups(JsonTextWriter.java:404)\n\tat
 
org.apache.solr.common.util.JsonTextWriter.writeNamedList(JsonTextWriter.java:312)\n\tat
 org.apache.solr.common.util.TextWriter.writeVal(TextWriter.java:77)\n\tat 
org.apache.solr.response.TextResponseWriter.writeVal(TextResponseWriter.java:213)\n\tat
 org.apache.solr.common.util.TextWriter.writeVal(TextWriter.java:48)\n\tat 
org.apache.solr.common.util.JsonTextWriter.writeNamedListAsMapWithDups(JsonTextWriter.java:404)\n\tat
 
org.apache.solr.common.util.JsonTextWriter.writeNamedList(JsonTextWriter.java:312)\n\tat
 
org.apache.solr.response.JacksonJsonWriter$WriterImpl.writeResponse(JacksonJsonWriter.java:88)\n\tat
 
org.apache.solr.response.JacksonJsonWriter.write(JacksonJsonWriter.java:50)\n\tat
 
org.apache.solr.response.QueryResponseWriterUtil.writeQueryResponse(QueryResponseWriterUtil.java:55)\n\tat
 
org.apache.solr.servlet.HttpSolrCall.writeResponse(HttpSolrCall.java:1031)\n\tat
 org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:621)\n\tat 
org.apache.solr.servlet.SolrDispatchFilter.dispatch(SolrDispatchFilter.java:262)\n\tat
 
org.apache.solr.servlet.SolrDispatchFilter.lambda$doFilter$0(SolrDispatchFilter.java:219)\n\tat
 
org.apache.solr.servlet.ServletUtils.traceHttpRequestExecution2(ServletUtils.java:249)\n\tat
 
org.apache.solr.servlet.ServletUtils.rateLimitRequest(ServletUtils.java:215)\n\tat
 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:213)\n\tat
 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:195)\n\tat
 org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210)\n\tat 
org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)\n\tat
 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)\n\tat
 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:598)\n\tat
 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)\n\tat
 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)\n\tat
 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)\n\tat 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)\n\tat
 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)\n\tat
 
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)\n\tat
 
org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:228)\n\tat
 
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141)\n\tat
 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)\n\tat
 
org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:301)\n\tat
 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)\n\tat
 
org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:822)\n\tat
 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)\n\tat
 org.eclipse.jetty.server.Server.handle(Server.java:563)\n\tat 
org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)\n\tat
 org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)\n\tat 
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)\n\tat 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)\n\tat
 
org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)\n\tat
 org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)\n\tat 
org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)\n\tat
 
org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)\n\tat
 
org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)\n\tat
 
org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)\n\tat
 
org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)\n\tat
 
org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)\n\tat
 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)\n\tat
 
org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)\n\tat
 
org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)\n\tat
 java.base/java.lang.Thread.run(Thread.java:1570)\nCaused by: 
java.lang.IllegalAccessException: access violation: class 
org.apache.solr.search.ValueSourceParser$LongConstValueSource, from public 
Lookup\n\tat 
java.base/java.lang.invoke.MethodHandles$Lookup.makeAccessException(MethodHandles.java:2919)\n\tat
 
java.base/java.lang.invoke.MethodHandles$Lookup.accessClass(MethodHandles.java:2998)\n\tat
 
org.apache.solr.common.util.Utils.addTraditionalFieldWriters(Utils.java:972)\n\tat
 org.apache.solr.common.util.Utils.getReflectData(Utils.java:931)\n\tat 
org.apache.solr.common.util.Utils.getReflectWriter(Utils.java:866)\n\t... 62 
more\n",
    "code":500
  }
}

Reply via email to