[
https://issues.apache.org/jira/browse/SOLR-17464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17894129#comment-17894129
]
ASF subversion and git services commented on SOLR-17464:
--------------------------------------------------------
Commit f19981143abe05682a9a20b6c3c87b5923fba8d8 in solr's branch
refs/heads/branch_9_7 from James Dyer
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=f19981143ab ]
SOLR-17464: Fixed Http2SolrClient bug in that 'requestAsync' triggered NPE when
using a shared Jetty client (#2733)
> Http2SolrClient.requestAsync triggers NPE when using a shared Jetty client
> --------------------------------------------------------------------------
>
> Key: SOLR-17464
> URL: https://issues.apache.org/jira/browse/SOLR-17464
> Project: Solr
> Issue Type: Bug
> Affects Versions: main (10.0), 9.7
> Reporter: Jason Gerlowski
> Assignee: James Dyer
> Priority: Major
> Labels: newdev
> Fix For: 9.8
>
>
> Http2SolrClient can be configured to either create its own Jetty HttpClient,
> or reuse an existing one.
> In this latter "reuse" case, the Http2SolrClient never sets the "executor"
> instance variable. This causes a NullPointerException any time the
> SolrClient's "requestAsync" method is called, which expects "executor" to be
> set.
> The bug is easy to reproduce with the following JUnit code (that, as of
> writing, can be dropped into Http2SolrClientTest and run):
> {code}
> @Test
> public void testReproduceExecutorNPEBug() {
> DebugServlet.clear();
> final var url = getBaseUrl() + DEBUG_SERVLET_PATH;
> final var queryParams = new ModifiableSolrParams();
> queryParams.add("q", "*:*");
> try (Http2SolrClient originalClient = new
> Http2SolrClient.Builder(url).withDefaultCollection(DEFAULT_CORE).build()) {
> // TODO The 'requestAsync' call below should succeed, but produces an
> NPE since
> try (Http2SolrClient derivedClient = new
> Http2SolrClient.Builder(url).withDefaultCollection(DEFAULT_CORE).withHttpClient(originalClient).build())
> {
> final var future = derivedClient.requestAsync(new
> QueryRequest(queryParams));
> final var results = future.join();
> }
> }
> }
> {code}
> And the exception:
> {code}
> 3429 INFO (h2sc-21-thread-2) [n: c: s: r: x: t:] o.e.j.c.ResponseNotifier
> Exception while notifying listener
> org.apache.solr.client.solrj.impl.Http2SolrClient$1@34bcd66e
> => java.lang.NullPointerException: Cannot invoke
> "java.util.concurrent.ExecutorService.execute(java.lang.Runnable)" because
> "this.this$0.executor" is null
> at
> org.apache.solr.client.solrj.impl.Http2SolrClient$1.onHeaders(Http2SolrClient.java:447)
> java.lang.NullPointerException: Cannot invoke
> "java.util.concurrent.ExecutorService.execute(java.lang.Runnable)" because
> "this.this$0.executor" is null
> at
> org.apache.solr.client.solrj.impl.Http2SolrClient$1.onHeaders(Http2SolrClient.java:447)
> ~[main/:?]
> at
> org.eclipse.jetty.client.ResponseNotifier.notifyHeaders(ResponseNotifier.java:95)
> [jetty-client-10.0.22.jar:10.0.22]
> at
> org.eclipse.jetty.client.ResponseNotifier.notifyHeaders(ResponseNotifier.java:87)
> [jetty-client-10.0.22.jar:10.0.22]
> at
> org.eclipse.jetty.client.HttpReceiver.responseHeaders(HttpReceiver.java:327)
> [jetty-client-10.0.22.jar:10.0.22]
> at
> org.eclipse.jetty.http2.client.http.HttpReceiverOverHTTP2.onHeaders(HttpReceiverOverHTTP2.java:120)
> [http2-http-client-transport-10.0.22.jar:10.0.22]
> at
> org.eclipse.jetty.http2.client.http.HttpChannelOverHTTP2$Listener.onHeaders(HttpChannelOverHTTP2.java:186)
> [http2-http-client-transport-10.0.22.jar:10.0.22]
> ...
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]