You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "James Dyer (Jira)" <ji...@apache.org> on 2024/10/03 16:14:00 UTC

[jira] [Resolved] (SOLR-17464) Http2SolrClient.requestAsync triggers NPE when using a shared Jetty client

     [ https://issues.apache.org/jira/browse/SOLR-17464?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Dyer resolved SOLR-17464.
-------------------------------
    Resolution: Fixed

> 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
>             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: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org