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

ASF subversion and git services commented on SOLR-17464:
--------------------------------------------------------

Commit 3d76ccdf65c0a1231b40c937f72ba174ae3a0dff in solr's branch 
refs/heads/branch_9x from James Dyer
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=3d76ccdf65c ]

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
>      Security Level: Public(Default Security Level. Issues are Public) 
>    Affects Versions: main (10.0), 9.7
>            Reporter: Jason Gerlowski
>            Assignee: James Dyer
>            Priority: Major
>              Labels: newdev
>
> 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: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to